adamchainz / flake8-comprehensions

❄️ A flake8 plugin to help you write better list/set/dict comprehensions.
MIT License
464 stars 23 forks source link

test_version: flake8 plugins not normalized #558

Open bnavigator opened 7 months ago

bnavigator commented 7 months ago

Python Version

3.9.18

flake8 Version

7.0.0

Package Version

3.14.0

Description

I am not sure what changed in our setup but we encounter a silly test failure since January 2 (which was before the release of flake8 7.0.0)

[   18s] =================================== FAILURES ===================================
[   18s] _________________________________ test_version _________________________________
[   18s] [gw0] linux -- Python 3.9.18 /usr/bin/python3.9
[   18s] 
[   18s] flake8_path = Flake8Path('/tmp/pytest-of-abuild/pytest-0/popen-gw0/flake8_path22')
[   18s] 
[   18s]     def test_version(flake8_path):
[   18s]         result = flake8_path.run_flake8(["--version"])
[   18s]         version_regex = r"flake8-comprehensions:( )*" + version("flake8-comprehensions")
[   18s]         unwrapped = "".join(result.out_lines)
[   18s] >       assert re.search(version_regex, unwrapped)
[   18s] E       AssertionError: assert None
[   18s] E        +  where None = <function search at 0x7fd86c6ad0d0>('flake8-comprehensions:( )*3.14.0', '7.0.0 (flake8_comprehensions: 3.14.0, mccabe: 0.7.0, pycodestyle: 2.11.1,pyflakes: 3.2.0) CPython 3.9.18 on Linux')
[   18s] E        +    where <function search at 0x7fd86c6ad0d0> = re.search
[   18s] 
[   18s] tests/test_flake8_comprehensions.py:27: AssertionError
[   18s] =========================== short test summary info ============================
[   18s] FAILED tests/test_flake8_comprehensions.py::test_version - AssertionError: as...
[   18s] ======================== 1 failed, 137 passed in 5.04s =========================
adamchainz commented 7 months ago

I don’t generally support running the tests outside of the tox setup within the repo.

I would consider merging a fix if you could explain why the name is changed. Afaiu flake8 pluus the name from the name attribute, which is a fixed string: https://github.com/adamchainz/flake8-comprehensions/blob/219d2fada9ccf3f174063ce426af72c8f6181052/src/flake8_comprehensions/__init__.py#L14