We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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_import_sorting.py
Describe the bug When pytest is run from outside the Darker source tree, some tests fail.
pytest
To Reproduce Steps to reproduce the behavior:
git clone https://github.com/akaihola/darker
pip install './darker[test]'
pytest ./darker/src/darker/tests/test_import_sorting.py
Expected behavior No test failures
Screenshots
pytest ./darker/src/darker/tests/test_import_sorting.py ================================================ test session starts ================================================ platform linux -- Python 3.11.3, pytest-7.3.1, pluggy-1.0.0 rootdir: /tmp/darker configfile: pytest.ini plugins: darker-0.1.2, kwparametrize-0.0.3 collected 64 items darker/src/darker/tests/test_import_sorting.py ..............................................F.F............. [ 96%] .. [100%] ===================================================== FAILURES ====================================================== ___________________________________ test_build_isort_args[src0-None-None-expect0] ___________________________________ src = PosixPath('file.py'), config = None, line_length = None, expect = {'settings_path': '/tmp'} @pytest.mark.kwparametrize( dict(src=Path("file.py"), expect={"settings_path": "{cwd}"}), dict( config="myconfig.toml", expect={"settings_file": "myconfig.toml"}, ), dict(line_length=42, expect={"settings_path": "{cwd}", "line_length": 42}), src=Path("file.py"), config=None, line_length=None, ) def test_build_isort_args(src, config, line_length, expect): """``_build_isort_args`` returns correct arguments for isort""" result = darker.import_sorting._build_isort_args(src, config, line_length) if "settings_path" in expect: expect["settings_path"] = str(expect["settings_path"].format(cwd=Path.cwd())) > assert result == expect E AssertionError: assert {'settings_path': '/'} == {'settings_path': '/tmp'} E Differing items: E {'settings_path': '/'} != {'settings_path': '/tmp'} E Use -v to get more diff darker/src/darker/tests/test_import_sorting.py:184: AssertionError ____________________________________ test_build_isort_args[src2-None-42-expect2] ____________________________________ src = PosixPath('file.py'), config = None, line_length = 42, expect = {'line_length': 42, 'settings_path': '/tmp'} @pytest.mark.kwparametrize( dict(src=Path("file.py"), expect={"settings_path": "{cwd}"}), dict( config="myconfig.toml", expect={"settings_file": "myconfig.toml"}, ), dict(line_length=42, expect={"settings_path": "{cwd}", "line_length": 42}), src=Path("file.py"), config=None, line_length=None, ) def test_build_isort_args(src, config, line_length, expect): """``_build_isort_args`` returns correct arguments for isort""" result = darker.import_sorting._build_isort_args(src, config, line_length) if "settings_path" in expect: expect["settings_path"] = str(expect["settings_path"].format(cwd=Path.cwd())) > assert result == expect E AssertionError: assert {'line_length...gs_path': '/'} == {'line_length...path': '/tmp'} E Omitting 1 identical items, use -vv to show E Differing items: E {'settings_path': '/'} != {'settings_path': '/tmp'} E Use -v to get more diff darker/src/darker/tests/test_import_sorting.py:184: AssertionError ================================================= warnings summary ================================================== ../home/kaiant/.virtualenvs/py311/lib/python3.11/site-packages/_pytest/config/__init__.py:1302 /home/kaiant/.virtualenvs/py311/lib/python3.11/site-packages/_pytest/config/__init__.py:1302: PytestConfigWarning: Unknown config option: show_capture self._warn_or_fail_if_strict(f"Unknown config option: {key}\n") -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =============================================== slowest 10 durations ================================================ 0.02s call src/darker/tests/test_import_sorting.py::test_apply_isort[content2-expect2-\n-utf-8] 0.02s call src/darker/tests/test_import_sorting.py::test_apply_isort[content2-expect2-\r\n-utf-8] 0.02s call src/darker/tests/test_import_sorting.py::test_apply_isort[content4-expect4-\n-utf-8] 0.01s call src/darker/tests/test_import_sorting.py::test_apply_isort[content2-expect2-\n-iso-8859-1] 0.01s call src/darker/tests/test_import_sorting.py::test_apply_isort[content4-expect4-\n-iso-8859-1] 0.01s call src/darker/tests/test_import_sorting.py::test_apply_isort[content1-expect1-\r\n-iso-8859-1] 0.01s call src/darker/tests/test_import_sorting.py::test_apply_isort[content3-expect3-\n-iso-8859-1] 0.01s call src/darker/tests/test_import_sorting.py::test_apply_isort[content3-expect3-\r\n-iso-8859-1] 0.01s call src/darker/tests/test_import_sorting.py::test_apply_isort[content3-expect3-\n-utf-8] 0.01s call src/darker/tests/test_import_sorting.py::test_apply_isort[content2-expect2-\r\n-iso-8859-1] ============================================== short test summary info ============================================== FAILED darker/src/darker/tests/test_import_sorting.py::test_build_isort_args[src0-None-None-expect0] - AssertionError: assert {'settings_path': '/'} == {'settings_path': '/tmp'} FAILED darker/src/darker/tests/test_import_sorting.py::test_build_isort_args[src2-None-42-expect2] - AssertionError: assert {'line_length...gs_path': '/'} == {'line_length...path': '/tmp'} ====================================== 2 failed, 62 passed, 1 warning in 0.76s ======================================
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered:
akaihola
Successfully merging a pull request may close this issue.
Describe the bug
When
pytest
is run from outside the Darker source tree, some tests fail.To Reproduce
Steps to reproduce the behavior:
git clone https://github.com/akaihola/darker
pip install './darker[test]'
pytest ./darker/src/darker/tests/test_import_sorting.py
Expected behavior
No test failures
Screenshots
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: