flake8-pie icon indicating copy to clipboard operation
flake8-pie copied to clipboard

0.14.0: pytest is failing

Open kloczek opened this issue 4 years ago • 10 comments

I'm trying to package your module as rpm packag. So I'm using typical in such case build, install and test cycle used on building package from non-root account:

  • "setup.py build"
  • "setup.py install --root </install/prefix>"
  • "pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

May I ask for help because few units are failing:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-flake8-pie-0.14.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-flake8-pie-0.14.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/tkloczko/rpmbuild/BUILD/flake8-pie-0.14.0
plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, case-1.5.3, aspectlib-1.5.2, toolbox-0.5, rerunfailures-9.1.1, requests-mock-1.9.3, cov-2.12.1, pyfakefs-4.5.0, flaky-3.7.0, benchmark-3.4.1, xdist-2.3.0, pylama-7.7.1, datadir-1.3.1, regressions-2.2.0, cases-3.6.3, xprocess-0.18.1, black-0.3.12, checkdocs-2.7.1, anyio-3.3.0, Faker-8.11.0, asyncio-0.15.1, trio-0.7.0, httpbin-1.0.0, subtests-0.5.0, isort-2.0.0, hypothesis-6.14.6, mock-3.6.1, profiling-1.7.0
collected 231 items

. .                                                                                                                                                                  [  0%]
flake8_pie/test_utils.py .                                                                                                                                           [  0%]
flake8_pie/tests/test_pie781_assign_and_return.py ........                                                                                                           [  4%]
flake8_pie/tests/test_pie783_celery_explicit_names.py .........                                                                                                      [  8%]
flake8_pie/tests/test_pie784_celery_crontab_args.py ..............                                                                                                   [ 14%]
flake8_pie/tests/test_pie785_celery_require_tasks_expire.py .....                                                                                                    [ 16%]
flake8_pie/tests/test_pie786_precise_exception_handler.py ...................                                                                                        [ 24%]
flake8_pie/tests/test_pie787_no_len_condition.py ........                                                                                                            [ 28%]
flake8_pie/tests/test_pie788_no_bool_condition.py ........                                                                                                           [ 31%]
flake8_pie/tests/test_pie789_prefer_isinstance_type_compare.py ..........                                                                                            [ 36%]
flake8_pie/tests/test_pie790_no_unnecessary_pass.py ....................                                                                                             [ 44%]
flake8_pie/tests/test_pie791_no_pointless_statements.py ............                                                                                                 [ 50%]
flake8_pie/tests/test_pie792_no_inherit_object.py .....                                                                                                              [ 52%]
flake8_pie/tests/test_pie793_prefer_dataclass.py .................                                                                                                   [ 59%]
flake8_pie/tests/test_pie794_dupe_class_field_definitions.py ....                                                                                                    [ 61%]
flake8_pie/tests/test_pie795_prefer_stdlib_enums.py ........                                                                                                         [ 64%]
flake8_pie/tests/test_pie796_prefer_unique_enums.py ..........                                                                                                       [ 69%]
flake8_pie/tests/test_pie797_no_unnecessary_if_expr.py .....                                                                                                         [ 71%]
flake8_pie/tests/test_pie798_no_unnecessary_class.py ..........                                                                                                      [ 75%]
flake8_pie/tests/test_pie799_prefer_col_init.py .................                                                                                                    [ 83%]
flake8_pie/tests/test_pie800_no_unnecessary_spread.py ....                                                                                                           [ 84%]
flake8_pie/tests/test_pie801_prefer_simple_return.py ...                                                                                                             [ 86%]
flake8_pie/tests/test_pie802_prefer_simple_any_all.py .FF.                                                                                                           [ 87%]
flake8_pie/tests/test_pie803_prefer_logging_interpolation.py .........                                                                                               [ 91%]
flake8_pie/tests/test_pie804_no_unnecessary_dict_kwargs.py ......                                                                                                    [ 94%]
flake8_pie/tests/test_pie805_prefer_literal.py ....                                                                                                                  [ 96%]
flake8_pie/tests/test_pie806_no_assert_except.py ...                                                                                                                 [ 97%]
flake8_pie/tests/test_pie807_prefer_list_builtin.py ....                                                                                                             [ 99%]
flake8_pie/tests/test_pie808_prefer_simple_range.py ..                                                                                                               [100%]

================================================================================= FAILURES =================================================================================
_____________________________________________________ test_prefer_simple_any_all[\nany([x.id for x in bar])\n-errors1] _____________________________________________________

code = '\nany([x.id for x in bar])\n', errors = [Error(lineno=2, col_offset=5, message='PIE802: prefer-simple-any-all: remove unnecessary comprehension.')]

    @pytest.mark.parametrize("code,errors", EXAMPLES)
    def test_prefer_simple_any_all(code: str, errors: list[Error]) -> None:
        expr = ast.parse(code)
>       assert to_errors(Flake8PieCheck(expr, filename="foo.py").run()) == errors
E       AssertionError: assert [Error(lineno...prehension.')] == [Error(lineno...prehension.')]
E         At index 0 diff: Error(lineno=2, col_offset=4, message='PIE802: prefer-simple-any-all: remove unnecessary comprehension.') != Error(lineno=2, col_offset=5, message='PIE802: prefer-simple-any-all: remove unnecessary comprehension.')
E         Use -v to get the full diff

flake8_pie/tests/test_pie802_prefer_simple_any_all.py:47: AssertionError
_____________________________________________________ test_prefer_simple_any_all[\nall([x.id for x in bar])\n-errors2] _____________________________________________________

code = '\nall([x.id for x in bar])\n', errors = [Error(lineno=2, col_offset=5, message='PIE802: prefer-simple-any-all: remove unnecessary comprehension.')]

    @pytest.mark.parametrize("code,errors", EXAMPLES)
    def test_prefer_simple_any_all(code: str, errors: list[Error]) -> None:
        expr = ast.parse(code)
>       assert to_errors(Flake8PieCheck(expr, filename="foo.py").run()) == errors
E       AssertionError: assert [Error(lineno...prehension.')] == [Error(lineno...prehension.')]
E         At index 0 diff: Error(lineno=2, col_offset=4, message='PIE802: prefer-simple-any-all: remove unnecessary comprehension.') != Error(lineno=2, col_offset=5, message='PIE802: prefer-simple-any-all: remove unnecessary comprehension.')
E         Use -v to get the full diff

flake8_pie/tests/test_pie802_prefer_simple_any_all.py:47: AssertionError
========================================================================= short test summary info ==========================================================================
FAILED flake8_pie/tests/test_pie802_prefer_simple_any_all.py::test_prefer_simple_any_all[\nany([x.id for x in bar])\n-errors1] - AssertionError: assert [Error(lineno...p...
FAILED flake8_pie/tests/test_pie802_prefer_simple_any_all.py::test_prefer_simple_any_all[\nall([x.id for x in bar])\n-errors2] - AssertionError: assert [Error(lineno...p...
====================================================================== 2 failed, 228 passed in 14.51s ======================================================================
pytest-xprocess reminder::Be sure to terminate the started process by running 'pytest --xkill' if you have not explicitly done so in your fixture with 'xprocess.getinfo(<process_name>).terminate()'.

kloczek avatar Aug 15 '21 10:08 kloczek

hmm, II'm not sure why that is happening

If I run pip freeze inside the virtual env I get:

appdirs==1.4.4
appnope==0.1.2
argh==0.26.2
astpretty==2.1.0
atomicwrites==1.4.0
attrs==20.3.0
backcall==0.2.0
black==18.9b0
bleach==3.3.0
certifi==2020.12.5
chardet==4.0.0
click==7.1.2
colorama==0.4.4
decorator==5.0.6
docopt==0.6.2
docutils==0.17
flake8==3.9.0
-e [email protected]:sbdchd/flake8-pie.git@0be8b1ba2e6436339753ce9cb1b91ae8fa02a4d7#egg=flake8_pie
idna==2.10
importlib-metadata==3.10.0
ipython==7.22.0
ipython-genutils==0.2.0
isort==4.3.21
jedi==0.18.0
mccabe==0.6.1
more-itertools==8.7.0
mypy==0.812
mypy-extensions==0.4.3
packaging==20.9
parso==0.8.2
pathtools==0.1.2
pexpect==4.8.0
pickleshare==0.7.5
pkginfo==1.7.0
pluggy==0.13.1
prompt-toolkit==3.0.18
ptyprocess==0.7.0
py==1.10.0
pycodestyle==2.7.0
pyflakes==2.3.1
Pygments==2.8.1
pyparsing==2.4.7
pytest==4.6.11
pytest-watch==4.2.0
PyYAML==3.13
readme-renderer==29.0
requests==2.25.1
requests-toolbelt==0.9.1
six==1.15.0
toml==0.10.2
tqdm==4.60.0
traitlets==5.0.5
twine==1.15.0
typed-ast==1.4.3
typing-extensions==3.10.0.0
urllib3==1.22
watchdog==2.0.2
wcwidth==0.2.5
webencodings==0.5.1
zipp==3.4.1

Does your setup have something similar?

sbdchd avatar Aug 15 '21 16:08 sbdchd

Just tested 0.15.0 and I have still failing units

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-flake8-pie-0.15.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-flake8-pie-0.15.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/flake8-pie-0.15.0
plugins: flaky-3.7.0
collected 233 items

flake8_pie/test_utils.py .                                                                                                                                           [  0%]
flake8_pie/tests/test_pie781_assign_and_return.py ........                                                                                                           [  3%]
flake8_pie/tests/test_pie783_celery_explicit_names.py .........                                                                                                      [  7%]
flake8_pie/tests/test_pie784_celery_crontab_args.py ..............                                                                                                   [ 13%]
flake8_pie/tests/test_pie785_celery_require_tasks_expire.py .....                                                                                                    [ 15%]
flake8_pie/tests/test_pie786_precise_exception_handler.py ...................                                                                                        [ 24%]
flake8_pie/tests/test_pie787_no_len_condition.py ........                                                                                                            [ 27%]
flake8_pie/tests/test_pie788_no_bool_condition.py ........                                                                                                           [ 30%]
flake8_pie/tests/test_pie789_prefer_isinstance_type_compare.py ..........                                                                                            [ 35%]
flake8_pie/tests/test_pie790_no_unnecessary_pass.py ....................                                                                                             [ 43%]
flake8_pie/tests/test_pie791_no_pointless_statements.py ............                                                                                                 [ 48%]
flake8_pie/tests/test_pie792_no_inherit_object.py .....                                                                                                              [ 51%]
flake8_pie/tests/test_pie793_prefer_dataclass.py .................                                                                                                   [ 58%]
flake8_pie/tests/test_pie794_dupe_class_field_definitions.py ....                                                                                                    [ 60%]
flake8_pie/tests/test_pie795_prefer_stdlib_enums.py ........                                                                                                         [ 63%]
flake8_pie/tests/test_pie796_prefer_unique_enums.py ..........                                                                                                       [ 67%]
flake8_pie/tests/test_pie797_no_unnecessary_if_expr.py .....                                                                                                         [ 69%]
flake8_pie/tests/test_pie798_no_unnecessary_class.py ..........                                                                                                      [ 74%]
flake8_pie/tests/test_pie799_prefer_col_init.py .................                                                                                                    [ 81%]
flake8_pie/tests/test_pie800_no_unnecessary_spread.py ....                                                                                                           [ 83%]
flake8_pie/tests/test_pie801_prefer_simple_return.py ...                                                                                                             [ 84%]
flake8_pie/tests/test_pie802_prefer_simple_any_all.py .FF.                                                                                                           [ 86%]
flake8_pie/tests/test_pie803_prefer_logging_interpolation.py .........                                                                                               [ 90%]
flake8_pie/tests/test_pie804_no_unnecessary_dict_kwargs.py ......                                                                                                    [ 92%]
flake8_pie/tests/test_pie805_prefer_literal.py ....                                                                                                                  [ 94%]
flake8_pie/tests/test_pie806_no_assert_except.py ...                                                                                                                 [ 95%]
flake8_pie/tests/test_pie807_prefer_list_builtin.py ....                                                                                                             [ 97%]
flake8_pie/tests/test_pie808_prefer_simple_range.py ..                                                                                                               [ 98%]
flake8_pie/tests/test_pie809_django_prefer_bulk.py FFF.                                                                                                              [100%]

================================================================================= FAILURES =================================================================================
_____________________________________________________ test_prefer_simple_any_all[\nany([x.id for x in bar])\n-errors1] _____________________________________________________

code = '\nany([x.id for x in bar])\n', errors = [Error(lineno=2, col_offset=5, message='PIE802: prefer-simple-any-all: remove unnecessary comprehension.')]

    @pytest.mark.parametrize("code,errors", EXAMPLES)
    def test_prefer_simple_any_all(code: str, errors: list[Error]) -> None:
        expr = ast.parse(code)
>       assert to_errors(Flake8PieCheck(expr, filename="foo.py").run()) == errors
E       AssertionError: assert [Error(lineno...prehension.')] == [Error(lineno...prehension.')]
E         At index 0 diff: Error(lineno=2, col_offset=4, message='PIE802: prefer-simple-any-all: remove unnecessary comprehension.') != Error(lineno=2, col_offset=5, message='PIE802: prefer-simple-any-all: remove unnecessary comprehension.')
E         Use -v to get the full diff

flake8_pie/tests/test_pie802_prefer_simple_any_all.py:47: AssertionError
_____________________________________________________ test_prefer_simple_any_all[\nall([x.id for x in bar])\n-errors2] _____________________________________________________

code = '\nall([x.id for x in bar])\n', errors = [Error(lineno=2, col_offset=5, message='PIE802: prefer-simple-any-all: remove unnecessary comprehension.')]

    @pytest.mark.parametrize("code,errors", EXAMPLES)
    def test_prefer_simple_any_all(code: str, errors: list[Error]) -> None:
        expr = ast.parse(code)
>       assert to_errors(Flake8PieCheck(expr, filename="foo.py").run()) == errors
E       AssertionError: assert [Error(lineno...prehension.')] == [Error(lineno...prehension.')]
E         At index 0 diff: Error(lineno=2, col_offset=4, message='PIE802: prefer-simple-any-all: remove unnecessary comprehension.') != Error(lineno=2, col_offset=5, message='PIE802: prefer-simple-any-all: remove unnecessary comprehension.')
E         Use -v to get the full diff

flake8_pie/tests/test_pie802_prefer_simple_any_all.py:47: AssertionError
_________________________________________________ test_examples[\n[Item.objects.create(item) for item in items]\n-errors0] _________________________________________________

code = '\n[Item.objects.create(item) for item in items]\n', errors = [Error(lineno=2, col_offset=1, message='PIE809: django-prefer-bulk: bulk create multiple objects.')]

    @pytest.mark.parametrize("code,errors", EXAMPLES)
    def test_examples(code: str, errors: list[Error]) -> None:
        expr = ast.parse(code)
>       assert to_errors(Flake8PieCheck(expr, filename="foo.py").run()) == errors
E       AssertionError: assert [Error(lineno...le objects.')] == [Error(lineno...le objects.')]
E         At index 0 diff: Error(lineno=2, col_offset=0, message='PIE809: django-prefer-bulk: bulk create multiple objects.') != Error(lineno=2, col_offset=1, message='PIE809: django-prefer-bulk: bulk create multiple objects.')
E         Use -v to get the full diff

flake8_pie/tests/test_pie809_django_prefer_bulk.py:43: AssertionError
_________________________________________ test_examples[\n[Item.objects.create(item) for item in [bar for bar in buzz]]\n-errors1] _________________________________________

code = '\n[Item.objects.create(item) for item in [bar for bar in buzz]]\n'
errors = [Error(lineno=2, col_offset=1, message='PIE809: django-prefer-bulk: bulk create multiple objects.')]

    @pytest.mark.parametrize("code,errors", EXAMPLES)
    def test_examples(code: str, errors: list[Error]) -> None:
        expr = ast.parse(code)
>       assert to_errors(Flake8PieCheck(expr, filename="foo.py").run()) == errors
E       AssertionError: assert [Error(lineno...le objects.')] == [Error(lineno...le objects.')]
E         At index 0 diff: Error(lineno=2, col_offset=0, message='PIE809: django-prefer-bulk: bulk create multiple objects.') != Error(lineno=2, col_offset=1, message='PIE809: django-prefer-bulk: bulk create multiple objects.')
E         Use -v to get the full diff

flake8_pie/tests/test_pie809_django_prefer_bulk.py:43: AssertionError
_________________________________________________ test_examples[\n(Item.objects.create(item) for item in items)\n-errors2] _________________________________________________

code = '\n(Item.objects.create(item) for item in items)\n', errors = [Error(lineno=2, col_offset=1, message='PIE809: django-prefer-bulk: bulk create multiple objects.')]

    @pytest.mark.parametrize("code,errors", EXAMPLES)
    def test_examples(code: str, errors: list[Error]) -> None:
        expr = ast.parse(code)
>       assert to_errors(Flake8PieCheck(expr, filename="foo.py").run()) == errors
E       AssertionError: assert [Error(lineno...le objects.')] == [Error(lineno...le objects.')]
E         At index 0 diff: Error(lineno=2, col_offset=0, message='PIE809: django-prefer-bulk: bulk create multiple objects.') != Error(lineno=2, col_offset=1, message='PIE809: django-prefer-bulk: bulk create multiple objects.')
E         Use -v to get the full diff

flake8_pie/tests/test_pie809_django_prefer_bulk.py:43: AssertionError
========================================================================= short test summary info ==========================================================================
FAILED flake8_pie/tests/test_pie802_prefer_simple_any_all.py::test_prefer_simple_any_all[\nany([x.id for x in bar])\n-errors1] - AssertionError: assert [Error(lineno...p...
FAILED flake8_pie/tests/test_pie802_prefer_simple_any_all.py::test_prefer_simple_any_all[\nall([x.id for x in bar])\n-errors2] - AssertionError: assert [Error(lineno...p...
FAILED flake8_pie/tests/test_pie809_django_prefer_bulk.py::test_examples[\n[Item.objects.create(item) for item in items]\n-errors0] - AssertionError: assert [Error(linen...
FAILED flake8_pie/tests/test_pie809_django_prefer_bulk.py::test_examples[\n[Item.objects.create(item) for item in [bar for bar in buzz]]\n-errors1] - AssertionError: ass...
FAILED flake8_pie/tests/test_pie809_django_prefer_bulk.py::test_examples[\n(Item.objects.create(item) for item in items)\n-errors2] - AssertionError: assert [Error(linen...
====================================================================== 5 failed, 228 passed in 0.75s =======================================================================

Here is list of modules in build nv:

[tkloczko@ss-desktop SPECS]$ pip list
Package            Version
------------------ -------------------
appdirs            1.4.4
attrs              21.4.0
build              0.7.0
chardet            4.0.0
cycler             0.11.0
dbus-python        1.2.18
distro             1.6.0
extras             1.0.0
fixtures           3.0.0
flaky              3.7.0
fonttools          4.28.5
genty              1.3.2
gpg                1.16.0-unknown
importlib-metadata 4.10.0
iniconfig          1.1.1
kiwisolver         1.3.2
libcomps           0.1.18
lit                13.0.0
lxml               4.7.1
Mako               1.1.6.dev0
Markdown           3.3.6
MarkupSafe         2.0.1
matplotlib         3.5.1
meson              0.60.3
numpy              1.22.0
olefile            0.46
packaging          21.3
pbr                5.8.0
pep517             0.12.0
Pillow             9.0.0
pip                21.3.1
pluggy             1.0.0
py                 1.11.0
Pygments           2.11.1
PyGObject          3.42.0
pyparsing          3.0.6
pytest             6.2.5
python-dateutil    2.8.2
rpm                4.17.0
scour              0.38.2
setuptools         60.1.0.post20211225
six                1.16.0
smartypants        2.0.1
testtools          2.5.0
toml               0.10.2
tomli              2.0.0
typing_extensions  4.0.1
typogrify          2.0.7
zipp               3.7.0

kloczek avatar Jan 05 '22 03:01 kloczek

Hmm I usually use poetry to manage my virtual envs (although this repo is using a truly ancient version)

But if you create a virtual env and install all the dependencies with the same versions:

appdirs==1.4.4
appnope==0.1.2
argh==0.26.2
astpretty==2.1.0
atomicwrites==1.4.0
attrs==20.3.0
backcall==0.2.0
black==18.9b0
bleach==3.3.0
certifi==2020.12.5
chardet==4.0.0
click==7.1.2
colorama==0.4.4
decorator==5.0.6
docopt==0.6.2
docutils==0.17
flake8==3.9.0
-e [email protected]:sbdchd/flake8-pie.git@0be8b1ba2e6436339753ce9cb1b91ae8fa02a4d7#egg=flake8_pie
idna==2.10
importlib-metadata==3.10.0
ipython==7.22.0
ipython-genutils==0.2.0
isort==4.3.21
jedi==0.18.0
mccabe==0.6.1
more-itertools==8.7.0
mypy==0.812
mypy-extensions==0.4.3
packaging==20.9
parso==0.8.2
pathtools==0.1.2
pexpect==4.8.0
pickleshare==0.7.5
pkginfo==1.7.0
pluggy==0.13.1
prompt-toolkit==3.0.18
ptyprocess==0.7.0
py==1.10.0
pycodestyle==2.7.0
pyflakes==2.3.1
Pygments==2.8.1
pyparsing==2.4.7
pytest==4.6.11
pytest-watch==4.2.0
PyYAML==3.13
readme-renderer==29.0
requests==2.25.1
requests-toolbelt==0.9.1
six==1.15.0
toml==0.10.2
tqdm==4.60.0
traitlets==5.0.5
twine==1.15.0
typed-ast==1.4.3
typing-extensions==3.10.0.0
urllib3==1.22
watchdog==2.0.2
wcwidth==0.2.5
webencodings==0.5.1
zipp==3.4.1

do the tests still fail?

sbdchd avatar Jan 05 '22 03:01 sbdchd

Hmm I usually use poetry to manage my virtual envs (although this repo is using a truly ancient version)

BTW: nn mean time I've switched to pep517 build procerure. On using pep517 poetry, flit or setuptools is not necesary to be present in build env to generate .whl archive.

kloczek avatar Jan 05 '22 05:01 kloczek

I've switches to pep517 and lates poetry build shows me:

+ /usr/bin/python3 -sBm build -w --no-isolation
* Getting dependencies for wheel...

ERROR Missing dependencies:
        poetry>=0.12
        cachecontrol[filecache] (>=0.12.9,<0.13.0) -> lockfile (>=0.9)

However after --skip-dependency-check I was able to build .whl

+ /usr/bin/python3 -sBm build -w --no-isolation --skip-dependency-check
* Building wheel...
Successfully built flake8_pie-0.15.0-py3-none-any.whl

However pytest still is failing

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-flake8-pie-0.15.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-flake8-pie-0.15.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/flake8-pie-0.15.0, configfile: tox.ini
collected 233 items

flake8_pie/test_utils.py .
flake8_pie/tests/test_pie781_assign_and_return.py ........
flake8_pie/tests/test_pie783_celery_explicit_names.py .........
flake8_pie/tests/test_pie784_celery_crontab_args.py ..............
flake8_pie/tests/test_pie785_celery_require_tasks_expire.py .....
flake8_pie/tests/test_pie786_precise_exception_handler.py ...................
flake8_pie/tests/test_pie787_no_len_condition.py ........
flake8_pie/tests/test_pie788_no_bool_condition.py ........
flake8_pie/tests/test_pie789_prefer_isinstance_type_compare.py ..........
flake8_pie/tests/test_pie790_no_unnecessary_pass.py ....................
flake8_pie/tests/test_pie791_no_pointless_statements.py ............
flake8_pie/tests/test_pie792_no_inherit_object.py .....
flake8_pie/tests/test_pie793_prefer_dataclass.py .................
flake8_pie/tests/test_pie794_dupe_class_field_definitions.py ....
flake8_pie/tests/test_pie795_prefer_stdlib_enums.py ........
flake8_pie/tests/test_pie796_prefer_unique_enums.py ..........
flake8_pie/tests/test_pie797_no_unnecessary_if_expr.py .....
flake8_pie/tests/test_pie798_no_unnecessary_class.py ..........
flake8_pie/tests/test_pie799_prefer_col_init.py .................
flake8_pie/tests/test_pie800_no_unnecessary_spread.py ....
flake8_pie/tests/test_pie801_prefer_simple_return.py ...
flake8_pie/tests/test_pie802_prefer_simple_any_all.py .FF.
flake8_pie/tests/test_pie803_prefer_logging_interpolation.py .........
flake8_pie/tests/test_pie804_no_unnecessary_dict_kwargs.py ......
flake8_pie/tests/test_pie805_prefer_literal.py ....
flake8_pie/tests/test_pie806_no_assert_except.py ...
flake8_pie/tests/test_pie807_prefer_list_builtin.py ....
flake8_pie/tests/test_pie808_prefer_simple_range.py ..
flake8_pie/tests/test_pie809_django_prefer_bulk.py FFF.

================================================================================= FAILURES =================================================================================
_____________________________________________________ test_prefer_simple_any_all[\nany([x.id for x in bar])\n-errors1] _____________________________________________________

code = '\nany([x.id for x in bar])\n', errors = [Error(lineno=2, col_offset=5, message='PIE802: prefer-simple-any-all: remove unnecessary comprehension.')]

    @pytest.mark.parametrize("code,errors", EXAMPLES)
    def test_prefer_simple_any_all(code: str, errors: list[Error]) -> None:
        expr = ast.parse(code)
>       assert to_errors(Flake8PieCheck(expr, filename="foo.py").run()) == errors
E       AssertionError: assert [Error(lineno...prehension.')] == [Error(lineno...prehension.')]
E         At index 0 diff: Error(lineno=2, col_offset=4, message='PIE802: prefer-simple-any-all: remove unnecessary comprehension.') != Error(lineno=2, col_offset=5, message='PIE802: prefer-simple-any-all: remove unnecessary comprehension.')
E         Use -v to get the full diff

flake8_pie/tests/test_pie802_prefer_simple_any_all.py:47: AssertionError
_____________________________________________________ test_prefer_simple_any_all[\nall([x.id for x in bar])\n-errors2] _____________________________________________________

code = '\nall([x.id for x in bar])\n', errors = [Error(lineno=2, col_offset=5, message='PIE802: prefer-simple-any-all: remove unnecessary comprehension.')]

    @pytest.mark.parametrize("code,errors", EXAMPLES)
    def test_prefer_simple_any_all(code: str, errors: list[Error]) -> None:
        expr = ast.parse(code)
>       assert to_errors(Flake8PieCheck(expr, filename="foo.py").run()) == errors
E       AssertionError: assert [Error(lineno...prehension.')] == [Error(lineno...prehension.')]
E         At index 0 diff: Error(lineno=2, col_offset=4, message='PIE802: prefer-simple-any-all: remove unnecessary comprehension.') != Error(lineno=2, col_offset=5, message='PIE802: prefer-simple-any-all: remove unnecessary comprehension.')
E         Use -v to get the full diff

flake8_pie/tests/test_pie802_prefer_simple_any_all.py:47: AssertionError
_________________________________________________ test_examples[\n[Item.objects.create(item) for item in items]\n-errors0] _________________________________________________

code = '\n[Item.objects.create(item) for item in items]\n', errors = [Error(lineno=2, col_offset=1, message='PIE809: django-prefer-bulk: bulk create multiple objects.')]

    @pytest.mark.parametrize("code,errors", EXAMPLES)
    def test_examples(code: str, errors: list[Error]) -> None:
        expr = ast.parse(code)
>       assert to_errors(Flake8PieCheck(expr, filename="foo.py").run()) == errors
E       AssertionError: assert [Error(lineno...le objects.')] == [Error(lineno...le objects.')]
E         At index 0 diff: Error(lineno=2, col_offset=0, message='PIE809: django-prefer-bulk: bulk create multiple objects.') != Error(lineno=2, col_offset=1, message='PIE809: django-prefer-bulk: bulk create multiple objects.')
E         Use -v to get the full diff

flake8_pie/tests/test_pie809_django_prefer_bulk.py:43: AssertionError
_________________________________________ test_examples[\n[Item.objects.create(item) for item in [bar for bar in buzz]]\n-errors1] _________________________________________

code = '\n[Item.objects.create(item) for item in [bar for bar in buzz]]\n'
errors = [Error(lineno=2, col_offset=1, message='PIE809: django-prefer-bulk: bulk create multiple objects.')]

    @pytest.mark.parametrize("code,errors", EXAMPLES)
    def test_examples(code: str, errors: list[Error]) -> None:
        expr = ast.parse(code)
>       assert to_errors(Flake8PieCheck(expr, filename="foo.py").run()) == errors
E       AssertionError: assert [Error(lineno...le objects.')] == [Error(lineno...le objects.')]
E         At index 0 diff: Error(lineno=2, col_offset=0, message='PIE809: django-prefer-bulk: bulk create multiple objects.') != Error(lineno=2, col_offset=1, message='PIE809: django-prefer-bulk: bulk create multiple objects.')
E         Use -v to get the full diff

flake8_pie/tests/test_pie809_django_prefer_bulk.py:43: AssertionError
_________________________________________________ test_examples[\n(Item.objects.create(item) for item in items)\n-errors2] _________________________________________________

code = '\n(Item.objects.create(item) for item in items)\n', errors = [Error(lineno=2, col_offset=1, message='PIE809: django-prefer-bulk: bulk create multiple objects.')]

    @pytest.mark.parametrize("code,errors", EXAMPLES)
    def test_examples(code: str, errors: list[Error]) -> None:
        expr = ast.parse(code)
>       assert to_errors(Flake8PieCheck(expr, filename="foo.py").run()) == errors
E       AssertionError: assert [Error(lineno...le objects.')] == [Error(lineno...le objects.')]
E         At index 0 diff: Error(lineno=2, col_offset=0, message='PIE809: django-prefer-bulk: bulk create multiple objects.') != Error(lineno=2, col_offset=1, message='PIE809: django-prefer-bulk: bulk create multiple objects.')
E         Use -v to get the full diff

flake8_pie/tests/test_pie809_django_prefer_bulk.py:43: AssertionError
============================================================================= warnings summary =============================================================================
../../../../../usr/lib/python3.8/site-packages/_pytest/config/__init__.py:1233
  /usr/lib/python3.8/site-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: norecursedir

    self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")

-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================= short test summary info ==========================================================================
FAILED flake8_pie/tests/test_pie802_prefer_simple_any_all.py::test_prefer_simple_any_all[\nany([x.id for x in bar])\n-errors1] - AssertionError: assert [Error(lineno...p...
FAILED flake8_pie/tests/test_pie802_prefer_simple_any_all.py::test_prefer_simple_any_all[\nall([x.id for x in bar])\n-errors2] - AssertionError: assert [Error(lineno...p...
FAILED flake8_pie/tests/test_pie809_django_prefer_bulk.py::test_examples[\n[Item.objects.create(item) for item in items]\n-errors0] - AssertionError: assert [Error(linen...
FAILED flake8_pie/tests/test_pie809_django_prefer_bulk.py::test_examples[\n[Item.objects.create(item) for item in [bar for bar in buzz]]\n-errors1] - AssertionError: ass...
FAILED flake8_pie/tests/test_pie809_django_prefer_bulk.py::test_examples[\n(Item.objects.create(item) for item in items)\n-errors2] - AssertionError: assert [Error(linen...
================================================================= 5 failed, 228 passed, 1 warning in 0.54s =================================================================

Eny hints what I can try to do? Build env is a bit freshen

Package            Version
------------------ -------------------
appdirs            1.4.4
attrs              21.4.0
build              0.7.0
CacheControl       0.12.10
cachy              0.3.0
cffi               1.15.0
chardet            4.0.0
charset-normalizer 2.0.10
cleo               0.8.1
clikit             0.6.2
crashtest          0.3.1
cryptography       36.0.1
cycler             0.11.0
dbus-python        1.2.18
distlib            0.3.4
distro             1.6.0
extras             1.0.0
filelock           3.4.2
fixtures           3.0.0
fonttools          4.28.5
gpg                1.16.0-unknown
html5lib           1.1
idna               3.3
importlib-metadata 4.10.0
iniconfig          1.1.1
jeepney            0.7.1
keyring            23.5.0
kiwisolver         1.3.2
libcomps           0.1.18
lit                13.0.0
lxml               4.7.1
matplotlib         3.5.1
meson              0.60.3
msgpack            1.0.3
numpy              1.22.0
olefile            0.46
packaging          21.3
pastel             0.2.1
pbr                5.8.0
pep517             0.12.0
pexpect            4.8.0
Pillow             9.0.0
pip                21.3.1
pkginfo            1.8.2
platformdirs       2.4.1
pluggy             1.0.0
ply                3.11
poetry             1.1.12
poetry-core        1.0.7
ptyprocess         0.7.0
py                 1.11.0
pycparser          2.21
PyGObject          3.42.0
pylev              1.4.0
pyparsing          3.0.6
pytest             6.2.5
python-dateutil    2.8.2
requests           2.27.1
requests-toolbelt  0.9.1
rpm                4.17.0
scour              0.38.2
SecretStorage      3.3.1
setuptools         60.1.0.post20211225
shellingham        1.4.0
six                1.16.0
testtools          2.5.0
toml               0.10.2
tomli              2.0.0
tomlkit            0.8.0
typing_extensions  4.0.1
urllib3            1.26.8
virtualenv         20.13.0
webencodings       0.5.1
zipp               3.7.0

kloczek avatar Jan 11 '22 10:01 kloczek

I think that at least build dependencies can be updated.

kloczek avatar Jan 11 '22 10:01 kloczek