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: run flake8 with custom cfg to make it aware of flake8_quotes #123

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mika
Copy link

@mika mika commented 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: #122
Thanks: @zeha for assistance

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 this pull request may close these issues.

test/test_checks.py: flake8 test relies on flake8-quotes extension being present
1 participant