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

tests/unit/test_pylama_isort.py::TestLinter::test_run fails from the PyPI tarball #1552

Closed
sbraz opened this issue Oct 10, 2020 · 2 comments · Fixed by hypothesis/viahtml#107 or wwade/jobrunner#63

Comments

@sbraz
Copy link
Contributor

sbraz commented Oct 10, 2020

Hi,
tests/unit/test_pylama_isort.py::TestLinter::test_run seems to work fine from the git repository but fails from the PyPI tarball:

============================= test session starts ==============================
platform linux -- Python 3.8.6, pytest-6.1.1, py-1.9.0, pluggy-0.13.1 -- /usr/local/bin/python
cachedir: .pytest_cache
rootdir: /isort-5.6.1
plugins: pylama-7.7.1
collecting ... collected 1 item

tests/unit/test_pylama_isort.py::TestLinter::test_run FAILED

=================================== FAILURES ===================================
_____________________________ TestLinter.test_run ______________________________

self = <tests.unit.test_pylama_isort.TestLinter object at 0x7fbcd57c85e0>
src_dir = '/isort-5.6.1/isort'
tmpdir = local('/tmp/pytest-of-root/pytest-0/test_run0')

    def test_run(self, src_dir, tmpdir):
>       assert not self.instance.run(os.path.join(src_dir, "api.py"))
E       AssertionError: assert not [{'col': 0, 'lnum': 0, 'text': 'Incorrectly sorted imports.', 'type': 'ISORT'}]
E        +  where [{'col': 0, 'lnum': 0, 'text': 'Incorrectly sorted imports.', 'type': 'ISORT'}] = <bound method Linter.run of <isort.pylama_isort.Linter object at 0x7fbcd56e1d30>>('/isort-5.6.1/isort/api.py')
E        +    where <bound method Linter.run of <isort.pylama_isort.Linter object at 0x7fbcd56e1d30>> = <isort.pylama_isort.Linter object at 0x7fbcd56e1d30>.run
E        +      where <isort.pylama_isort.Linter object at 0x7fbcd56e1d30> = <tests.unit.test_pylama_isort.TestLinter object at 0x7fbcd57c85e0>.instance
E        +    and   '/isort-5.6.1/isort/api.py' = <function join at 0x7fbcd6656550>('/isort-5.6.1/isort', 'api.py')
E        +      where <function join at 0x7fbcd6656550> = <module 'posixpath' from '/usr/local/lib/python3.8/posixpath.py'>.join
E        +        where <module 'posixpath' from '/usr/local/lib/python3.8/posixpath.py'> = os.path

tests/unit/test_pylama_isort.py:15: AssertionError
=========================== short test summary info ============================
FAILED tests/unit/test_pylama_isort.py::TestLinter::test_run - AssertionError...
============================== 1 failed in 0.09s ===============================
ERROR: /isort-5.6.1/isort/api.py Imports are incorrectly sorted and/or formatted.

Reproducer Dockerfile:

FROM python:3.8
RUN wget https://files.pythonhosted.org/packages/source/i/isort/isort-5.6.1.tar.gz && \
  tar xf isort-5.6.1.tar.gz && \
  pip install pytest pylama
WORKDIR isort-5.6.1
RUN pytest -s -vv tests/unit/test_pylama_isort.py::TestLinter::test_run
@timothycrosley
Copy link
Member

I believe this is due to the test as it was written being too reliant on living within the exact source tree. If that's the cause the release of 5.6.2 should resolve this.

Thanks!

~Timothy

@sbraz
Copy link
Contributor Author

sbraz commented Oct 10, 2020

Works fine with 5.6.2, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment