script: fix linter error in test runner #20240

pull jonatack wants to merge 1 commits into bitcoin:master from jonatack:fix-python-linter-error changing 1 files +12 −7
  1. jonatack commented at 9:53 PM on October 25, 2020: member

    I started noticing this recently:

    before this commit

    $ ./test/lint/lint-python.sh
    test/functional/test_runner.py:42: error: Module has no attribute "getwindowsversion"
    Found 1 error in 1 file (checked 180 source files)
    

    after

    $ ./test/lint/lint-python.sh
    Success: no issues found in 180 source files
    

    versions

    $ python3 -V -V
    Python 3.8.6 (default, Sep 25 2020, 09:36:53)
    [GCC 10.2.0]
    
    $ flake8 --version
    3.7.8 (mccabe: 0.6.1, pycodestyle: 2.5.0, pyflakes: 2.1.1) CPython 3.8.6 on Linux
    

    There may be a better way to fix it, but this works for me.

  2. script: fix linter error in test_runner.py
    before this commit
    
    $ ./test/lint/lint-python.sh
    test/functional/test_runner.py:42: error: Module has no attribute "getwindowsversion"
    Found 1 error in 1 file (checked 180 source files)
    
    after
    
    $ ./test/lint/lint-python.sh
    Success: no issues found in 180 source files
    
    $ python3 -V -V
    Python 3.8.6 (default, Sep 25 2020, 09:36:53)
    [GCC 10.2.0]
    46bedb7fc3
  3. in test/functional/test_runner.py:42 in 46bedb7fc3
      38 | @@ -39,7 +39,17 @@
      39 |      CROSS = "x "
      40 |      CIRCLE = "o "
      41 |  
      42 | -if os.name != 'nt' or sys.getwindowsversion() >= (10, 0, 14393):
    


    jonatack commented at 10:15 PM on October 25, 2020:

    I wondered if we support Windows earlier than 10.0.14393 (major.minor.build), but it seems we do still support Windows 7 and newer.

  4. DrahtBot added the label Tests on Oct 25, 2020
  5. jonatack commented at 3:15 PM on October 27, 2020: member

    It looks like no one else is seeing this issue, or they don't mind. I'll just use the fix locally. Closing.

  6. jonatack closed this on Oct 27, 2020

  7. practicalswift commented at 3:29 PM on October 27, 2020: contributor

    Concept ACK

    If you're affected then most likely others are too. No harm in fixing this :)

  8. jonatack commented at 10:27 AM on November 18, 2020: member

    Still seeing this every day without this patch, so re-opening.

  9. jonatack reopened this on Nov 18, 2020

  10. MarcoFalke commented at 10:38 AM on November 18, 2020: member

    Your flake8 might be broken. Have you tried upgrading it?

  11. jonatack commented at 8:50 PM on November 19, 2020: member

    Yes, upgraded from

    $ flake8 --version
    3.7.8 (mccabe: 0.6.1, pycodestyle: 2.5.0, pyflakes: 2.1.1) CPython 3.8.6 on Linux
    

    to

    flake8 --version
    3.8.4 (mccabe: 0.6.1, pycodestyle: 2.6.0, pyflakes: 2.2.0) CPython 3.8.6 on Linux
    

    and still the same issue (and this patch still fixes it).

    Also tried --force-reinstall, sudo -H, --ignore-installed, etc.

  12. MarcoFalke commented at 11:05 AM on November 20, 2020: member

    Can you reproduce in a fresh vm?

  13. MarcoFalke commented at 6:42 PM on December 4, 2020: member

    Seems odd to change the code when the linter is at fault and should be fixed instead

  14. in test/functional/test_runner.py:55 in 46bedb7fc3
      51 | +if sys.platform != "win32":
      52 | +    set_ansi_formatting()
      53 | +elif os.name != 'nt' or sys.getwindowsversion() >= (10, 0, 14393):
      54 |      if os.name == 'nt':
      55 |          import ctypes
      56 |          kernel32 = ctypes.windll.kernel32  # type: ignore
    


    apoelstra commented at 6:44 PM on December 4, 2020:

    Could these type: ignore annotations also now be removed?

  15. jonatack commented at 6:55 PM on January 3, 2021: member

    Up for grabs.

  16. jonatack closed this on Jan 3, 2021

  17. michaelfolkson commented at 7:55 PM on January 3, 2021: contributor

    I can reproduce the error but this should be fixed with a PR to the flake8 repo?

    Seems odd to change the code when the linter is at fault and should be fixed instead

  18. kristapsk commented at 9:35 PM on February 12, 2021: contributor

    I have the same issue on my laptop currently.

  19. jonatack commented at 9:42 PM on February 12, 2021: member

    Yep, I still have it too.

  20. DrahtBot locked this on Aug 16, 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-14 21:14 UTC

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