Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test/test_checks.py: flake8 test relies on flake8-quotes extension being present #122

Open
mika opened this issue Oct 11, 2024 · 0 comments · May be fixed by #123
Open

test/test_checks.py: flake8 test relies on flake8-quotes extension being present #122

mika opened this issue Oct 11, 2024 · 0 comments · May be fixed by #123

Comments

@mika
Copy link

mika commented Oct 11, 2024

This was reported as https://bugs.debian.org/1080108 in Debian, quoting the relevant build failure:

FAIL: test_stdin (test.test_checks.TestFlake8Stdin.test_stdin)
Test using stdin.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/.pybuild/cpython3_3.12/build/test/test_checks.py", line 24, in test_stdin
    self.assertEqual(len(stdout_lines), 3)
AssertionError: 0 != 3

This is caused by executing flake8 -select=Q - < data/doubles.py without having the flake8-quotes extension explicitly available at this stage.

I provided a MR for the Debian packaging at https://salsa.debian.org/python-team/packages/flake8-quotes/-/merge_requests/1 and will provide a PR here which makes sure to run flake8 with a custom configuration which makes sure the flake8-quotes package is found.

mika pushed a commit to mika/flake8-quotes that referenced this issue Oct 11, 2024
Otherwise flake8 might run without the flake8-quotes extension and
doesn't report anything:

| root@e519011a98e7:/code# flake8 --select=Q - < test/data/doubles.py
| root@e519011a98e7:/code#

Only when the flake8-quotes package is around, it behaves as expected:

| root@e519011a98e7:/code# pip install --break-system-packages -e .
| [...]
| root@e519011a98e7:/code# flake8 --select=Q - < test/data/doubles.py
| stdin:1:25: Q000 Double quotes found but single quotes preferred
| stdin:2:25: Q000 Double quotes found but single quotes preferred
| stdin:3:25: Q000 Double quotes found but single quotes preferred

E.g. during a Debian package build we don't have the flake8-quotes
package installed, though we can make flake8 aware of the local plugin
through a configuration file.

Fixes:

| Traceback (most recent call last):
|   File "/<<PKGBUILDDIR>>/.pybuild/cpython3_3.12/build/test/test_checks.py", line 24, in test_stdin
|     self.assertEqual(len(stdout_lines), 3)
| AssertionError: 0 != 3

Closes: zheller#122
Thanks: Chris Hofstaedtler <[email protected]> for assistance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant