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

0.4.1: test suite fails in 4 units with pytest 8.2.1 #62

Open
kloczek opened this issue May 26, 2024 · 0 comments
Open

0.4.1: test suite fails in 4 units with pytest 8.2.1 #62

kloczek opened this issue May 26, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@kloczek
Copy link

kloczek commented May 26, 2024

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix> using installer module
  • run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
  • build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")
Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-hatch-requirements-txt-0.4.1-2.fc37.x86_64/usr/lib64/python3.10/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-hatch-requirements-txt-0.4.1-2.fc37.x86_64/usr/lib/python3.10/site-packages
+ /usr/bin/pytest -ra -m 'not network'
============================= test session starts ==============================
platform linux -- Python 3.10.14, pytest-8.2.1, pluggy-1.5.0
Test session started at 11:20:00
rootdir: /home/tkloczko/rpmbuild/BUILD/hatch-requirements-txt-0.4.1
configfile: tox.ini
plugins: datadir-1.5.0, regressions-2.5.0, timeout-2.3.1
timeout: 300.0s
timeout method: signal
timeout func_only: False
collected 58 items

tests/test_errors.py ....FFFF................                            [ 41%]
tests/test_metadata.py ..................................                [100%]

=================================== FAILURES ===================================
_______________ test_not_dynamic_but_files_defined[build_wheel] ________________

tmp_pathplus = PosixPathPlus('/tmp/pytest-of-tkloczko/pytest-205/test_not_dynamic_but_files_def0')
build_func = <function build_wheel at 0x7fbfb2736d40>

    @pytest.mark.parametrize("build_func", [build_wheel, build_sdist])
    def test_not_dynamic_but_files_defined(tmp_pathplus: PathPlus, build_func: Callable):

        dist_dir = tmp_pathplus / "dist"
        dist_dir.maybe_make()

        (tmp_pathplus / "pyproject.toml").write_clean(pyproject_toml.replace('dynamic = ["dependencies"]', ''))
        (tmp_pathplus / "requirements.txt").write_lines(["Foo", "bar", "# fizz", "baz>1"])
        (tmp_pathplus / "README.md").touch()
        (tmp_pathplus / "LICENSE").touch()
        (tmp_pathplus / "demo").maybe_make()
        (tmp_pathplus / "demo" / "__init__.py").touch()

>       with in_directory(tmp_pathplus), pytest.raises(ValueError, match=(
                r"^Cannot specify 'files' in \[tool.hatch.metadata.hooks.requirements_txt\] "
                r"when 'dependencies' is not listed in 'project.dynamic'.$"
        )):
E    Failed: DID NOT RAISE <class 'ValueError'>

tests/test_errors.py:82: Failed
_______________ test_not_dynamic_but_files_defined[build_sdist] ________________

tmp_pathplus = PosixPathPlus('/tmp/pytest-of-tkloczko/pytest-205/test_not_dynamic_but_files_def1')
build_func = <function build_sdist at 0x7fbfb2736c20>

    @pytest.mark.parametrize("build_func", [build_wheel, build_sdist])
    def test_not_dynamic_but_files_defined(tmp_pathplus: PathPlus, build_func: Callable):

        dist_dir = tmp_pathplus / "dist"
        dist_dir.maybe_make()

        (tmp_pathplus / "pyproject.toml").write_clean(pyproject_toml.replace('dynamic = ["dependencies"]', ''))
        (tmp_pathplus / "requirements.txt").write_lines(["Foo", "bar", "# fizz", "baz>1"])
        (tmp_pathplus / "README.md").touch()
        (tmp_pathplus / "LICENSE").touch()
        (tmp_pathplus / "demo").maybe_make()
        (tmp_pathplus / "demo" / "__init__.py").touch()

>       with in_directory(tmp_pathplus), pytest.raises(ValueError, match=(
                r"^Cannot specify 'files' in \[tool.hatch.metadata.hooks.requirements_txt\] "
                r"when 'dependencies' is not listed in 'project.dynamic'.$"
        )):
E    Failed: DID NOT RAISE <class 'ValueError'>

tests/test_errors.py:82: Failed
______________ test_not_dynamic_but_filename_defined[build_wheel] ______________

tmp_pathplus = PosixPathPlus('/tmp/pytest-of-tkloczko/pytest-205/test_not_dynamic_but_filename_0')
build_func = <function build_wheel at 0x7fbfb2736d40>

    @pytest.mark.parametrize("build_func", [build_wheel, build_sdist])
    def test_not_dynamic_but_filename_defined(tmp_pathplus: PathPlus, build_func: Callable):

        dist_dir = tmp_pathplus / "dist"
        dist_dir.maybe_make()

        new_pyproject_toml = pyproject_toml.replace('dynamic = ["dependencies"]', '').replace(
                        'files = ["requirements.txt"]', 'filename = "requirements.txt"'
                        )
        (tmp_pathplus / "pyproject.toml").write_clean(new_pyproject_toml)
        (tmp_pathplus / "requirements.txt").write_lines(["Foo", "bar", "# fizz", "baz>1"])
        (tmp_pathplus / "README.md").touch()
        (tmp_pathplus / "LICENSE").touch()
        (tmp_pathplus / "demo").maybe_make()
        (tmp_pathplus / "demo" / "__init__.py").touch()

>       with in_directory(tmp_pathplus), pytest.raises(ValueError, match=(
                r"^Cannot specify 'filename' in \[tool.hatch.metadata.hooks.requirements_txt\] "
                r"when 'dependencies' is not listed in 'project.dynamic'.$"
        )):
E    Failed: DID NOT RAISE <class 'ValueError'>

tests/test_errors.py:105: Failed
______________ test_not_dynamic_but_filename_defined[build_sdist] ______________

tmp_pathplus = PosixPathPlus('/tmp/pytest-of-tkloczko/pytest-205/test_not_dynamic_but_filename_1')
build_func = <function build_sdist at 0x7fbfb2736c20>

    @pytest.mark.parametrize("build_func", [build_wheel, build_sdist])
    def test_not_dynamic_but_filename_defined(tmp_pathplus: PathPlus, build_func: Callable):

        dist_dir = tmp_pathplus / "dist"
        dist_dir.maybe_make()

        new_pyproject_toml = pyproject_toml.replace('dynamic = ["dependencies"]', '').replace(
                        'files = ["requirements.txt"]', 'filename = "requirements.txt"'
                        )
        (tmp_pathplus / "pyproject.toml").write_clean(new_pyproject_toml)
        (tmp_pathplus / "requirements.txt").write_lines(["Foo", "bar", "# fizz", "baz>1"])
        (tmp_pathplus / "README.md").touch()
        (tmp_pathplus / "LICENSE").touch()
        (tmp_pathplus / "demo").maybe_make()
        (tmp_pathplus / "demo" / "__init__.py").touch()

>       with in_directory(tmp_pathplus), pytest.raises(ValueError, match=(
                r"^Cannot specify 'filename' in \[tool.hatch.metadata.hooks.requirements_txt\] "
                r"when 'dependencies' is not listed in 'project.dynamic'.$"
        )):
E    Failed: DID NOT RAISE <class 'ValueError'>

tests/test_errors.py:105: Failed
============================= slowest 25 durations =============================
0.02s call     tests/test_metadata.py::test_build_files_in_subdirectory[build_sdist]
0.02s call     tests/test_metadata.py::test_build_files_in_subdirectory[build_wheel]
0.02s call     tests/test_errors.py::test_missing_requirements_txt[build_wheel]
0.02s call     tests/test_errors.py::test_not_dynamic_but_files_defined[build_wheel]
0.01s call     tests/test_metadata.py::test_optional_dependencies[build_sdist]
0.01s call     tests/test_metadata.py::test_build_with_files[build_sdist]
0.01s call     tests/test_metadata.py::test_build_unspecified[build_wheel]
0.01s call     tests/test_metadata.py::test_optional_dependencies[build_wheel]
0.01s call     tests/test_metadata.py::test_build_pip_compile_style[build_sdist]
0.01s call     tests/test_metadata.py::test_build_with_filename[build_wheel]
0.01s call     tests/test_metadata.py::test_build_unspecified[build_sdist]
0.01s call     tests/test_metadata.py::test_using_project_deps_and_optional_deps[build_sdist]
0.01s call     tests/test_metadata.py::test_build_with_files[build_wheel]
0.01s call     tests/test_metadata.py::test_build_comments[build_wheel]
0.01s call     tests/test_metadata.py::test_build_with_filename[build_sdist]
0.01s call     tests/test_metadata.py::test_build_comments[build_sdist]
0.01s call     tests/test_errors.py::test_no_files_or_filename_deprecation[build_wheel]
0.01s call     tests/test_metadata.py::test_build_pip_compile_style[build_wheel]
0.01s call     tests/test_errors.py::test_filename_deprecation[build_wheel]
0.01s call     tests/test_errors.py::test_filename_deprecation[build_sdist]
0.01s call     tests/test_metadata.py::test_using_project_deps_and_optional_deps[build_wheel]
0.01s call     tests/test_errors.py::test_not_dynamic_but_files_defined[build_sdist]
0.01s call     tests/test_errors.py::test_no_files_or_filename_deprecation[build_sdist]
0.01s call     tests/test_errors.py::test_not_dynamic_but_filename_defined[build_wheel]
0.01s call     tests/test_errors.py::test_not_dynamic_but_filename_defined[build_sdist]
=========================== short test summary info ============================
FAILED tests/test_errors.py::test_not_dynamic_but_files_defined[build_wheel] - Failed: DID NOT RAISE <class 'ValueError'>
FAILED tests/test_errors.py::test_not_dynamic_but_files_defined[build_sdist] - Failed: DID NOT RAISE <class 'ValueError'>
FAILED tests/test_errors.py::test_not_dynamic_but_filename_defined[build_wheel] - Failed: DID NOT RAISE <class 'ValueError'>
FAILED tests/test_errors.py::test_not_dynamic_but_filename_defined[build_sdist] - Failed: DID NOT RAISE <class 'ValueError'>
========================= 4 failed, 54 passed in 0.64s =========================
List of installed modules in build env:
Package            Version
------------------ -----------
build              1.2.1
coincidence        0.6.6
domdf_python_tools 3.8.0.post2
exceptiongroup     1.1.3
hatchling          1.24.2
importlib_metadata 7.1.0
iniconfig          2.0.0
installer          0.7.0
natsort            8.4.0
packaging          24.0
pathspec           0.12.1
pkginfo            1.10.0
pluggy             1.5.0
pyproject_hooks    1.0.0
pytest             8.2.1
pytest-datadir     1.5.0
pytest-regressions 2.5.0
pytest-timeout     2.3.1
python-dateutil    2.9.0.post0
PyYAML             6.0.1
tokenize_rt        5.2.0
tomli              2.0.1
trove-classifiers  2024.5.24
typing_extensions  4.12.0
wheel              0.43.0
zipp               3.19.0

Please let me know if you need more details or want me to perform some diagnostics.

@kloczek kloczek added the bug Something isn't working label May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants