PyCQA / flake8-import-order

Flake8 plugin that checks import order against various Python Style Guides
GNU Lesser General Public License v3.0
278 stars 72 forks source link

flake8-import-order-0.12: test failure: Unknown style appnexus #105

Closed 0-wiz-0 closed 6 years ago

0-wiz-0 commented 7 years ago

When running the tests for flake8-import-order (pypi distfile) on NetBSD with python-3.6.1, I see:

cd .../flake8-import-order-0.12 && py.test-3.6
============================================================================= test session starts =============================================================================
platform netbsd7 -- Python 3.6.1, pytest-3.0.7, py-1.4.30, pluggy-0.4.0
rootdir: .../flake8-import-order-0.12, inifile:
plugins: pylama-7.3.3
collected 329 items / 1 errors 

=================================================================================== ERRORS ====================================================================================
_________________________________________________________________ ERROR collecting tests/test_style_cases.py __________________________________________________________________
flake8_import_order/styles.py:20: in lookup_entry_point
    return next(iter_entry_points('flake8_import_order.styles', name=name))
E   StopIteration

During handling of the above exception, another exception occurred:
tests/test_style_cases.py:59: in <module>
    _load_test_cases(),
tests/test_style_cases.py:39: in _load_test_cases
    style_entry_point = lookup_entry_point(style_name)
flake8_import_order/styles.py:22: in lookup_entry_point
    raise LookupError('Unknown style {}'.format(name))
E   LookupError: Unknown style appnexus
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
=========================================================================== 1 error in 0.35 seconds ===========================================================================
*** Error code 2
pgjones commented 7 years ago

Could you try executing tox -e py36? This will run the standard test case and will hopefully help explain why you see this error and I do not.

sigmavirus24 commented 7 years ago

I believe that you need to have the plugin installed for the entry-points to be registered. This is why using tox works (it installs the package).

0-wiz-0 commented 7 years ago

Running tox doesn't work because the tox.ini file is not in the pypi distfile.

I tried running it from git, looks like that:

tox -e py36
GLOB sdist-make: .../flake8-import-order/setup.py
py36 create: .../flake8-import-order/.tox/py36
py36 installdeps: coverage==3.7, pytest, pylama, pycodestyle>=2.0, pyflakes>=1.3.0
py36 inst: .../flake8-import-order/.tox/dist/flake8-import-order-0.12.zip
py36 installed: appdirs==1.4.3,coverage==3.7,flake8-import-order==0.12,mccabe==0.6.1,packaging==16.8,py==1.4.33,pycodestyle==2.3.1,pydocstyle==1.1.1,pyflakes==1.5.0,pylama==7.3.3,pyparsing==2.2.0,pytest==3.0.7,six==1.10.0
py36 runtests: PYTHONHASHSEED='192663199'
py36 runtests: commands[0] | coverage run --source=flake8_import_order/,tests/ -m pytest --capture=no --strict
============================================================================= test session starts =============================================================================
platform netbsd7 -- Python 3.6.1, pytest-3.0.7, py-1.4.33, pluggy-0.4.0
rootdir: .../flake8-import-order, inifile:
plugins: pylama-7.3.3
collected 381 items 

tests/test_flake8_linter.py ..
tests/test_pylama_linter.py .
tests/test_stdlib.py ......................................................................................................................................................................................................................................................................................................................................
tests/test_style_cases.py ....................................................

========================================================================= 381 passed in 2.10 seconds ==========================================================================
py36 runtests: commands[1] | coverage report -m
Name                                Stmts   Miss  Cover   Missing
-----------------------------------------------------------------
flake8_import_order/__about__          12      0   100%
flake8_import_order/__init__           54      0   100%
flake8_import_order/checker            40      0   100%
flake8_import_order/flake8_linter      44      0   100%
flake8_import_order/pylama_linter      22      0   100%
flake8_import_order/stdlib_list         1      0   100%
flake8_import_order/styles             86      2    98%   21-22
tests/__init__                          0      0   100%
tests/test_flake8_linter               29      0   100%
tests/test_pylama_linter                9      0   100%
tests/test_stdlib                      22      0   100%
tests/test_style_cases                 44      0   100%
-----------------------------------------------------------------
TOTAL                                 363      2    99%
___________________________________________________________________________________ summary ___________________________________________________________________________________
  py36: commands succeeded
  congratulations :)

So this seems to install a whole lot of dependencies:

py36 installdeps: coverage==3.7, pytest, pylama, pycodestyle>=2.0, pyflakes>=1.3.0
py36 inst: .../flake8-import-order/.tox/dist/flake8-import-order-0.12.zip
py36 installed: appdirs==1.4.3,coverage==3.7,flake8-import-order==0.12,mccabe==0.6.1,packaging==16.8,py==1.4.33,pycodestyle==2.3.1,pydocstyle==1.1.1,pyflakes==1.5.0,pylama==7.3.3,pyparsing==2.2.0,pytest==3.0.7,six==1.10.0

however, setup.py has many less:

    install_requires=[
        "pycodestyle",
        "setuptools",
    ],

    tests_require=[
        "pytest",
        "flake8",
        "pycodestyle",
        "pylama"
    ],

I think setup.py dependencies should be synced with what is really expected, then my issue will probably disappear.

sigmavirus24 commented 7 years ago

Frankly, tests_require is all kinds of awful. It should just be removed IMO.

pgjones commented 6 years ago

I'm going to close this as I don't see this as an issue needing to be fixed, feel free to convince me if you think otherwise.