test: avoid os-dependant path #18952

pull fametrano wants to merge 1 commits into bitcoin:master from fametrano:patch-2 changing 1 files +12 −2
  1. fametrano commented at 8:31 PM on May 11, 2020: contributor

    The current code fails on windows because of the forward slashes; using os.path.join solves the problem and it is in general more robust

  2. avoided os-dependant path
    The current code fails on windows because of the forward slashes; using os.path.join solves the problem and it is in general more robust
    8a22fd0114
  3. fametrano renamed this:
    avoided os-dependant path
    avoid os-dependant path
    on May 11, 2020
  4. DrahtBot added the label Tests on May 11, 2020
  5. fanquake commented at 9:52 AM on May 13, 2020: member

    @sipsorcery want to take a look here & confirm the fix for windows?

  6. sipsorcery commented at 9:55 AM on May 13, 2020: member

    Hmm Windows should typically be able to deal with / paths. Maybe it's a Python on Windows problem. I'll verify.

  7. MarcoFalke commented at 10:39 AM on May 13, 2020: member

    Jup, I don't think this is a bug fix. We've been running the functional tests on windows just fine.

  8. elichai commented at 12:30 PM on May 13, 2020: contributor

    FWIW, In the future if we really want to be have the slashes agnostic, we can use pathlib.Path which overrides the Div operator to insert slashes so you could do: Path(some_path) / 'src' / 'bitcoind'.

    https://docs.python.org/3/library/pathlib.html

  9. laanwj commented at 1:23 PM on May 13, 2020: member

    I like using os.path.join here (it's consistent—what we use in other places too). But yes, please change the motivation if it's a refactor not a fix.

  10. sipsorcery commented at 5:43 PM on May 13, 2020: member

    I can verify that the current test_framework.py on master doesn't have any path issues when run on Windows.

    It's hard to see where it could ever become a problem since modern day Windows accepts / as an alternative path separator.

    The command below works fine on my Windows 10 machine:

    cd c:/dev\github/sipsorcery_bitcoin//build_msvc

  11. fametrano commented at 1:11 AM on May 16, 2020: contributor

    I import the test suite code in another project to automate regtest testing: when looking for the bitcoind binary on a Windows 10 machine, Python 3.8.2, no WSL, the original code fails. Also, just two lines below the code is using os.path.join, so consistency is lacking

  12. MarcoFalke renamed this:
    avoid os-dependant path
    test: avoid os-dependant path
    on May 16, 2020
  13. MarcoFalke commented at 10:12 AM on May 16, 2020: member

    ACK 8a22fd01140bd957036fc00419b147e4268ae9b1

  14. MarcoFalke merged this on May 16, 2020
  15. MarcoFalke closed this on May 16, 2020

  16. sidhujag referenced this in commit dc527842e6 on May 17, 2020
  17. Fabcien referenced this in commit d733ebb73f on Feb 1, 2021
  18. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-29 03:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me