Git Product home page Git Product logo

whey-pth's Introduction

whey-pth

Extension to whey to support .pth files.

Docs Documentation Build Status Docs Check Status
Tests Linux Test Status Windows Test Status macOS Test Status Coverage
PyPI PyPI - Package Version PyPI - Supported Python Versions PyPI - Supported Implementations PyPI - Wheel
Anaconda Conda - Package Version Conda - Platform
Activity GitHub last commit Maintenance PyPI - Downloads
QA CodeFactor Grade Flake8 Status mypy status
Other License GitHub top language Requirements Status

Installation

whey-pth can be installed from PyPI or Anaconda.

To install with pip:

$ python -m pip install whey-pth

To install with conda:

  • First add the required channels
$ conda config --add channels https://conda.anaconda.org/conda-forge
$ conda config --add channels https://conda.anaconda.org/domdfcoding
  • Then install
$ conda install whey-pth

To enable whey-pth, add the following lines to your pyproject.toml file:

[tool.whey.builders]
wheel = "whey_pth_wheel"

The whey-pth-specific configuration is defined in the tool.whey-pth table. See the documentation for more details.

whey-pth's People

Contributors

domdfcoding avatar pre-commit-ci[bot] avatar repo-helper[bot] avatar

Stargazers

 avatar

Watchers

 avatar  avatar

whey-pth's Issues

0.0.4: pytest is failing

**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>
  • run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-whey-pth-0.0.4-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-whey-pth-0.0.4-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
Test session started at 16:53:07
rootdir: /home/tkloczko/rpmbuild/BUILD/whey-pth-0.0.4, configfile: tox.ini
plugins: datadir-1.3.1, regressions-2.3.1, timeout-2.1.0
timeout: 300.0s
timeout method: signal
timeout func_only: False
collected 9 items

tests/test_whey_pth.py FFFFFFF..                                                                                                                                     [100%]

================================================================================= FAILURES =================================================================================
_____________________________________________________________________ test_build_complete[WHEY_NO_PTH] _____________________________________________________________________

config = '[build-system]\nrequires = [ "whey",]\nbuild-backend = "whey"\n\n[project]\nname = "whey"\nversion = "2021.0.0"\ndesc...\nplatforms = [ "Windows", "macOS", "Linux",]\nlicense-key = "MIT"\n\n[tool.whey.builders]\nwheel = "whey_pth_wheel"\n'
tmp_pathplus = PosixPathPlus('/tmp/pytest-of-tkloczko/pytest-50/test_build_complete_WHEY_NO_PT0')
advanced_data_regression = <coincidence.regressions.AdvancedDataRegressionFixture object at 0x7f0fd596a370>
file_regression = <pytest_regressions.file_regression.FileRegressionFixture object at 0x7f0fd596a4f0>, capsys = <_pytest.capture.CaptureFixture object at 0x7f0fd596a700>

    @pytest.mark.parametrize(
                "config",
                [
                                pytest.param(WHEY_NO_PTH, id="WHEY_NO_PTH"),
                                pytest.param(COMPLETE_A, id="COMPLETE_A"),
                                pytest.param(COMPLETE_B, id="COMPLETE_B"),
                                ]
                )
    def test_build_complete(
                config: str,
                tmp_pathplus: PathPlus,
                advanced_data_regression: AdvancedDataRegressionFixture,
                file_regression: FileRegressionFixture,
                capsys,
                ):
        (tmp_pathplus / "pyproject.toml").write_clean(config)
        (tmp_pathplus / "whey").mkdir()
        (tmp_pathplus / "whey" / "__init__.py").write_clean("print('hello world)")
        (tmp_pathplus / "README.rst").write_clean("Spam Spam Spam Spam")
        (tmp_pathplus / "LICENSE").write_clean("This is the license")
        (tmp_pathplus / "requirements.txt").write_clean("domdf_python_tools")

        data = {}

        with tempfile.TemporaryDirectory() as tmpdir:
                wheel_builder = PthWheelBuilder(
                                project_dir=tmp_pathplus,
                                config=load_toml(tmp_pathplus / "pyproject.toml"),
                                build_dir=tmpdir,
                                out_dir=tmp_pathplus,
                                verbose=True,
                                colour=False,
                                )
                wheel = wheel_builder.build_wheel()
                assert (tmp_pathplus / wheel).is_file()
                zip_file = zipfile.ZipFile(tmp_pathplus / wheel)
                data["wheel_content"] = sorted(zip_file.namelist())

                with zip_file.open("whey/__init__.py", mode='r') as fp:
                        assert fp.read().decode("UTF-8") == "print('hello world)\n"

                with zip_file.open("whey-2021.0.0.dist-info/METADATA", mode='r') as fp:
                        check_file_regression(fp.read().decode("UTF-8"), file_regression)

                if config != WHEY_NO_PTH:
                        with zip_file.open("my_project.pth", mode='r') as fp:
                                assert fp.read().decode("UTF-8") == "import _virtualenv\n"

        with tempfile.TemporaryDirectory() as tmpdir:
                sdist_builder = SDistBuilder(
                                project_dir=tmp_pathplus,
                                config=load_toml(tmp_pathplus / "pyproject.toml"),
                                build_dir=tmpdir,
                                out_dir=tmp_pathplus,
                                verbose=True,
                                colour=False,
                                )
                sdist = sdist_builder.build_sdist()
                assert (tmp_pathplus / sdist).is_file()

                tar = tarfile.open(tmp_pathplus / sdist)
                data["sdist_content"] = sorted(tar.getnames())

                with tar.extractfile("whey-2021.0.0/whey/__init__.py") as fp:  # type: ignore
                        assert fp.read().decode("UTF-8") == "print('hello world)\n"
                with tar.extractfile("whey-2021.0.0/README.rst") as fp:  # type: ignore
                        assert fp.read().decode("UTF-8") == "Spam Spam Spam Spam\n"
                with tar.extractfile("whey-2021.0.0/LICENSE") as fp:  # type: ignore
                        assert fp.read().decode("UTF-8") == "This is the license\n"
                with tar.extractfile("whey-2021.0.0/requirements.txt") as fp:  # type: ignore
                        assert fp.read().decode("UTF-8") == "domdf_python_tools\n"

        outerr = capsys.readouterr()
        data["stdout"] = outerr.out.replace(tmp_pathplus.as_posix(), "...")
        data["stderr"] = outerr.err

>       advanced_data_regression.check(data)
E    AssertionError: FILES DIFFER:
E    /tmp/pytest-of-tkloczko/pytest-50/test_build_complete_WHEY_NO_PT0/test_whey_pth_/test_build_complete_WHEY_NO_PTH_.yml
E    /tmp/pytest-of-tkloczko/pytest-50/test_build_complete_WHEY_NO_PT0/test_whey_pth_/test_build_complete_WHEY_NO_PTH_.obtained.yml
E    HTML DIFF: /tmp/pytest-of-tkloczko/pytest-50/test_build_complete_WHEY_NO_PT0/test_whey_pth_/test_build_complete_WHEY_NO_PTH_.obtained.diff.html
E    ---
E    +++
E    @@ -15,8 +15,6 @@
E       Writing whey-2021.0.0.dist-info/METADATA
E
E       Writing whey-2021.0.0.dist-info/WHEEL
E    -
E    -  Writing whey-2021.0.0.dist-info/top_level.txt
E
E       Writing whey-2021.0.0.dist-info/RECORD
E
E    @@ -43,5 +41,4 @@
E     - whey-2021.0.0.dist-info/RECORD
E     - whey-2021.0.0.dist-info/WHEEL
E     - whey-2021.0.0.dist-info/entry_points.txt
E    -- whey-2021.0.0.dist-info/top_level.txt
E     - whey/__init__.py

tests/test_whey_pth.py:232: AssertionError
_____________________________________________________________________ test_build_complete[COMPLETE_A] ______________________________________________________________________

config = '[build-system]\nrequires = [ "whey",]\nbuild-backend = "whey"\n\n[project]\nname = "whey"\nversion = "2021.0.0"\ndesc....builders]\nwheel = "whey_pth_wheel"\n\n[tool.whey-pth]\nname = "my_project.pth"\npth-content = "import _virtualenv"\n'
tmp_pathplus = PosixPathPlus('/tmp/pytest-of-tkloczko/pytest-50/test_build_complete_COMPLETE_A0')
advanced_data_regression = <coincidence.regressions.AdvancedDataRegressionFixture object at 0x7f0fd57f0940>
file_regression = <pytest_regressions.file_regression.FileRegressionFixture object at 0x7f0fd5918c10>, capsys = <_pytest.capture.CaptureFixture object at 0x7f0fd5918eb0>

    @pytest.mark.parametrize(
                "config",
                [
                                pytest.param(WHEY_NO_PTH, id="WHEY_NO_PTH"),
                                pytest.param(COMPLETE_A, id="COMPLETE_A"),
                                pytest.param(COMPLETE_B, id="COMPLETE_B"),
                                ]
                )
    def test_build_complete(
                config: str,
                tmp_pathplus: PathPlus,
                advanced_data_regression: AdvancedDataRegressionFixture,
                file_regression: FileRegressionFixture,
                capsys,
                ):
        (tmp_pathplus / "pyproject.toml").write_clean(config)
        (tmp_pathplus / "whey").mkdir()
        (tmp_pathplus / "whey" / "__init__.py").write_clean("print('hello world)")
        (tmp_pathplus / "README.rst").write_clean("Spam Spam Spam Spam")
        (tmp_pathplus / "LICENSE").write_clean("This is the license")
        (tmp_pathplus / "requirements.txt").write_clean("domdf_python_tools")

        data = {}

        with tempfile.TemporaryDirectory() as tmpdir:
                wheel_builder = PthWheelBuilder(
                                project_dir=tmp_pathplus,
                                config=load_toml(tmp_pathplus / "pyproject.toml"),
                                build_dir=tmpdir,
                                out_dir=tmp_pathplus,
                                verbose=True,
                                colour=False,
                                )
                wheel = wheel_builder.build_wheel()
                assert (tmp_pathplus / wheel).is_file()
                zip_file = zipfile.ZipFile(tmp_pathplus / wheel)
                data["wheel_content"] = sorted(zip_file.namelist())

                with zip_file.open("whey/__init__.py", mode='r') as fp:
                        assert fp.read().decode("UTF-8") == "print('hello world)\n"

                with zip_file.open("whey-2021.0.0.dist-info/METADATA", mode='r') as fp:
                        check_file_regression(fp.read().decode("UTF-8"), file_regression)

                if config != WHEY_NO_PTH:
                        with zip_file.open("my_project.pth", mode='r') as fp:
                                assert fp.read().decode("UTF-8") == "import _virtualenv\n"

        with tempfile.TemporaryDirectory() as tmpdir:
                sdist_builder = SDistBuilder(
                                project_dir=tmp_pathplus,
                                config=load_toml(tmp_pathplus / "pyproject.toml"),
                                build_dir=tmpdir,
                                out_dir=tmp_pathplus,
                                verbose=True,
                                colour=False,
                                )
                sdist = sdist_builder.build_sdist()
                assert (tmp_pathplus / sdist).is_file()

                tar = tarfile.open(tmp_pathplus / sdist)
                data["sdist_content"] = sorted(tar.getnames())

                with tar.extractfile("whey-2021.0.0/whey/__init__.py") as fp:  # type: ignore
                        assert fp.read().decode("UTF-8") == "print('hello world)\n"
                with tar.extractfile("whey-2021.0.0/README.rst") as fp:  # type: ignore
                        assert fp.read().decode("UTF-8") == "Spam Spam Spam Spam\n"
                with tar.extractfile("whey-2021.0.0/LICENSE") as fp:  # type: ignore
                        assert fp.read().decode("UTF-8") == "This is the license\n"
                with tar.extractfile("whey-2021.0.0/requirements.txt") as fp:  # type: ignore
                        assert fp.read().decode("UTF-8") == "domdf_python_tools\n"

        outerr = capsys.readouterr()
        data["stdout"] = outerr.out.replace(tmp_pathplus.as_posix(), "...")
        data["stderr"] = outerr.err

>       advanced_data_regression.check(data)
E    AssertionError: FILES DIFFER:
E    /tmp/pytest-of-tkloczko/pytest-50/test_build_complete_COMPLETE_A0/test_whey_pth_/test_build_complete_COMPLETE_A_.yml
E    /tmp/pytest-of-tkloczko/pytest-50/test_build_complete_COMPLETE_A0/test_whey_pth_/test_build_complete_COMPLETE_A_.obtained.yml
E    HTML DIFF: /tmp/pytest-of-tkloczko/pytest-50/test_build_complete_COMPLETE_A0/test_whey_pth_/test_build_complete_COMPLETE_A_.obtained.diff.html
E    ---
E    +++
E    @@ -15,8 +15,6 @@
E       Writing whey-2021.0.0.dist-info/METADATA
E
E       Writing whey-2021.0.0.dist-info/WHEEL
E    -
E    -  Writing whey-2021.0.0.dist-info/top_level.txt
E
E       Writing my_project.pth
E
E    @@ -46,5 +44,4 @@
E     - whey-2021.0.0.dist-info/RECORD
E     - whey-2021.0.0.dist-info/WHEEL
E     - whey-2021.0.0.dist-info/entry_points.txt
E    -- whey-2021.0.0.dist-info/top_level.txt
E     - whey/__init__.py

tests/test_whey_pth.py:232: AssertionError
_____________________________________________________________________ test_build_complete[COMPLETE_B] ______________________________________________________________________

config = '[build-system]\nrequires = [ "whey",]\nbuild-backend = "whey"\n\n[project]\nname = "whey"\nversion = "2021.0.0"\ndesc...whey.builders]\nwheel = "whey_pth_wheel"\n\n[tool.whey-pth]\nname = "my_project"\npth-content = "import _virtualenv"\n'
tmp_pathplus = PosixPathPlus('/tmp/pytest-of-tkloczko/pytest-50/test_build_complete_COMPLETE_B0')
advanced_data_regression = <coincidence.regressions.AdvancedDataRegressionFixture object at 0x7f0fd575a0a0>
file_regression = <pytest_regressions.file_regression.FileRegressionFixture object at 0x7f0fd575a340>, capsys = <_pytest.capture.CaptureFixture object at 0x7f0fd575a4c0>

    @pytest.mark.parametrize(
                "config",
                [
                                pytest.param(WHEY_NO_PTH, id="WHEY_NO_PTH"),
                                pytest.param(COMPLETE_A, id="COMPLETE_A"),
                                pytest.param(COMPLETE_B, id="COMPLETE_B"),
                                ]
                )
    def test_build_complete(
                config: str,
                tmp_pathplus: PathPlus,
                advanced_data_regression: AdvancedDataRegressionFixture,
                file_regression: FileRegressionFixture,
                capsys,
                ):
        (tmp_pathplus / "pyproject.toml").write_clean(config)
        (tmp_pathplus / "whey").mkdir()
        (tmp_pathplus / "whey" / "__init__.py").write_clean("print('hello world)")
        (tmp_pathplus / "README.rst").write_clean("Spam Spam Spam Spam")
        (tmp_pathplus / "LICENSE").write_clean("This is the license")
        (tmp_pathplus / "requirements.txt").write_clean("domdf_python_tools")

        data = {}

        with tempfile.TemporaryDirectory() as tmpdir:
                wheel_builder = PthWheelBuilder(
                                project_dir=tmp_pathplus,
                                config=load_toml(tmp_pathplus / "pyproject.toml"),
                                build_dir=tmpdir,
                                out_dir=tmp_pathplus,
                                verbose=True,
                                colour=False,
                                )
                wheel = wheel_builder.build_wheel()
                assert (tmp_pathplus / wheel).is_file()
                zip_file = zipfile.ZipFile(tmp_pathplus / wheel)
                data["wheel_content"] = sorted(zip_file.namelist())

                with zip_file.open("whey/__init__.py", mode='r') as fp:
                        assert fp.read().decode("UTF-8") == "print('hello world)\n"

                with zip_file.open("whey-2021.0.0.dist-info/METADATA", mode='r') as fp:
                        check_file_regression(fp.read().decode("UTF-8"), file_regression)

                if config != WHEY_NO_PTH:
                        with zip_file.open("my_project.pth", mode='r') as fp:
                                assert fp.read().decode("UTF-8") == "import _virtualenv\n"

        with tempfile.TemporaryDirectory() as tmpdir:
                sdist_builder = SDistBuilder(
                                project_dir=tmp_pathplus,
                                config=load_toml(tmp_pathplus / "pyproject.toml"),
                                build_dir=tmpdir,
                                out_dir=tmp_pathplus,
                                verbose=True,
                                colour=False,
                                )
                sdist = sdist_builder.build_sdist()
                assert (tmp_pathplus / sdist).is_file()

                tar = tarfile.open(tmp_pathplus / sdist)
                data["sdist_content"] = sorted(tar.getnames())

                with tar.extractfile("whey-2021.0.0/whey/__init__.py") as fp:  # type: ignore
                        assert fp.read().decode("UTF-8") == "print('hello world)\n"
                with tar.extractfile("whey-2021.0.0/README.rst") as fp:  # type: ignore
                        assert fp.read().decode("UTF-8") == "Spam Spam Spam Spam\n"
                with tar.extractfile("whey-2021.0.0/LICENSE") as fp:  # type: ignore
                        assert fp.read().decode("UTF-8") == "This is the license\n"
                with tar.extractfile("whey-2021.0.0/requirements.txt") as fp:  # type: ignore
                        assert fp.read().decode("UTF-8") == "domdf_python_tools\n"

        outerr = capsys.readouterr()
        data["stdout"] = outerr.out.replace(tmp_pathplus.as_posix(), "...")
        data["stderr"] = outerr.err

>       advanced_data_regression.check(data)
E    AssertionError: FILES DIFFER:
E    /tmp/pytest-of-tkloczko/pytest-50/test_build_complete_COMPLETE_B0/test_whey_pth_/test_build_complete_COMPLETE_B_.yml
E    /tmp/pytest-of-tkloczko/pytest-50/test_build_complete_COMPLETE_B0/test_whey_pth_/test_build_complete_COMPLETE_B_.obtained.yml
E    HTML DIFF: /tmp/pytest-of-tkloczko/pytest-50/test_build_complete_COMPLETE_B0/test_whey_pth_/test_build_complete_COMPLETE_B_.obtained.diff.html
E    ---
E    +++
E    @@ -15,8 +15,6 @@
E       Writing whey-2021.0.0.dist-info/METADATA
E
E       Writing whey-2021.0.0.dist-info/WHEEL
E    -
E    -  Writing whey-2021.0.0.dist-info/top_level.txt
E
E       Writing my_project.pth
E
E    @@ -46,5 +44,4 @@
E     - whey-2021.0.0.dist-info/RECORD
E     - whey-2021.0.0.dist-info/WHEEL
E     - whey-2021.0.0.dist-info/entry_points.txt
E    -- whey-2021.0.0.dist-info/top_level.txt
E     - whey/__init__.py

tests/test_whey_pth.py:232: AssertionError
_________________________________________________________________ test_build_complete_foreman[WHEY_NO_PTH] _________________________________________________________________

config = '[build-system]\nrequires = [ "whey",]\nbuild-backend = "whey"\n\n[project]\nname = "whey"\nversion = "2021.0.0"\ndesc...\nplatforms = [ "Windows", "macOS", "Linux",]\nlicense-key = "MIT"\n\n[tool.whey.builders]\nwheel = "whey_pth_wheel"\n'
tmp_pathplus = PosixPathPlus('/tmp/pytest-of-tkloczko/pytest-50/test_build_complete_foreman_WH0')
advanced_data_regression = <coincidence.regressions.AdvancedDataRegressionFixture object at 0x7f0fd575d190>
file_regression = <pytest_regressions.file_regression.FileRegressionFixture object at 0x7f0fd575dbe0>, capsys = <_pytest.capture.CaptureFixture object at 0x7f0fd575dd00>

    @pytest.mark.parametrize(
                "config",
                [
                                pytest.param(WHEY_NO_PTH, id="WHEY_NO_PTH"),
                                pytest.param(COMPLETE_A, id="COMPLETE_A"),
                                pytest.param(COMPLETE_B, id="COMPLETE_B"),
                                ]
                )
    def test_build_complete_foreman(
                config: str,
                tmp_pathplus: PathPlus,
                advanced_data_regression: AdvancedDataRegressionFixture,
                file_regression: FileRegressionFixture,
                capsys,
                ):
        (tmp_pathplus / "pyproject.toml").write_clean(config)
        (tmp_pathplus / "whey").mkdir()
        (tmp_pathplus / "whey" / "__init__.py").write_clean("print('hello world)")
        (tmp_pathplus / "README.rst").write_clean("Spam Spam Spam Spam")
        (tmp_pathplus / "LICENSE").write_clean("This is the license")
        (tmp_pathplus / "requirements.txt").write_clean("domdf_python_tools")

        data = {}

        foreman = Foreman(project_dir=tmp_pathplus)

        with tempfile.TemporaryDirectory() as tmpdir:
                wheel = foreman.build_wheel(
                                build_dir=tmpdir,
                                out_dir=tmp_pathplus,
                                verbose=True,
                                colour=False,
                                )

                assert (tmp_pathplus / wheel).is_file()
                zip_file = zipfile.ZipFile(tmp_pathplus / wheel)
                data["wheel_content"] = sorted(zip_file.namelist())

                with zip_file.open("whey/__init__.py", mode='r') as fp:
                        assert fp.read().decode("UTF-8") == "print('hello world)\n"

                with zip_file.open("whey-2021.0.0.dist-info/METADATA", mode='r') as fp:
                        check_file_regression(fp.read().decode("UTF-8"), file_regression)

                if config != WHEY_NO_PTH:
                        with zip_file.open("my_project.pth", mode='r') as fp:
                                assert fp.read().decode("UTF-8") == "import _virtualenv\n"

        with tempfile.TemporaryDirectory() as tmpdir:
                sdist = foreman.build_sdist(
                                build_dir=tmpdir,
                                out_dir=tmp_pathplus,
                                verbose=True,
                                colour=False,
                                )
                assert (tmp_pathplus / sdist).is_file()

                tar = tarfile.open(tmp_pathplus / sdist)
                data["sdist_content"] = sorted(tar.getnames())

                with tar.extractfile("whey-2021.0.0/whey/__init__.py") as fp:  # type: ignore
                        assert fp.read().decode("UTF-8") == "print('hello world)\n"
                with tar.extractfile("whey-2021.0.0/README.rst") as fp:  # type: ignore
                        assert fp.read().decode("UTF-8") == "Spam Spam Spam Spam\n"
                with tar.extractfile("whey-2021.0.0/LICENSE") as fp:  # type: ignore
                        assert fp.read().decode("UTF-8") == "This is the license\n"
                with tar.extractfile("whey-2021.0.0/requirements.txt") as fp:  # type: ignore
                        assert fp.read().decode("UTF-8") == "domdf_python_tools\n"

        outerr = capsys.readouterr()
        data["stdout"] = outerr.out.replace(tmp_pathplus.as_posix(), "...")
        data["stderr"] = outerr.err

>       advanced_data_regression.check(data)
E    AssertionError: FILES DIFFER:
E    /tmp/pytest-of-tkloczko/pytest-50/test_build_complete_foreman_WH0/test_whey_pth_/test_build_complete_foreman_WHEY_NO_PTH_.yml
E    /tmp/pytest-of-tkloczko/pytest-50/test_build_complete_foreman_WH0/test_whey_pth_/test_build_complete_foreman_WHEY_NO_PTH_.obtained.yml
E    HTML DIFF: /tmp/pytest-of-tkloczko/pytest-50/test_build_complete_foreman_WH0/test_whey_pth_/test_build_complete_foreman_WHEY_NO_PTH_.obtained.diff.html
E    ---
E    +++
E    @@ -15,8 +15,6 @@
E       Writing whey-2021.0.0.dist-info/METADATA
E
E       Writing whey-2021.0.0.dist-info/WHEEL
E    -
E    -  Writing whey-2021.0.0.dist-info/top_level.txt
E
E       Writing whey-2021.0.0.dist-info/RECORD
E
E    @@ -43,5 +41,4 @@
E     - whey-2021.0.0.dist-info/RECORD
E     - whey-2021.0.0.dist-info/WHEEL
E     - whey-2021.0.0.dist-info/entry_points.txt
E    -- whey-2021.0.0.dist-info/top_level.txt
E     - whey/__init__.py

tests/test_whey_pth.py:308: AssertionError
_________________________________________________________________ test_build_complete_foreman[COMPLETE_A] __________________________________________________________________

config = '[build-system]\nrequires = [ "whey",]\nbuild-backend = "whey"\n\n[project]\nname = "whey"\nversion = "2021.0.0"\ndesc....builders]\nwheel = "whey_pth_wheel"\n\n[tool.whey-pth]\nname = "my_project.pth"\npth-content = "import _virtualenv"\n'
tmp_pathplus = PosixPathPlus('/tmp/pytest-of-tkloczko/pytest-50/test_build_complete_foreman_CO0')
advanced_data_regression = <coincidence.regressions.AdvancedDataRegressionFixture object at 0x7f0fd580fe80>
file_regression = <pytest_regressions.file_regression.FileRegressionFixture object at 0x7f0fd580f580>, capsys = <_pytest.capture.CaptureFixture object at 0x7f0fd567b970>

    @pytest.mark.parametrize(
                "config",
                [
                                pytest.param(WHEY_NO_PTH, id="WHEY_NO_PTH"),
                                pytest.param(COMPLETE_A, id="COMPLETE_A"),
                                pytest.param(COMPLETE_B, id="COMPLETE_B"),
                                ]
                )
    def test_build_complete_foreman(
                config: str,
                tmp_pathplus: PathPlus,
                advanced_data_regression: AdvancedDataRegressionFixture,
                file_regression: FileRegressionFixture,
                capsys,
                ):
        (tmp_pathplus / "pyproject.toml").write_clean(config)
        (tmp_pathplus / "whey").mkdir()
        (tmp_pathplus / "whey" / "__init__.py").write_clean("print('hello world)")
        (tmp_pathplus / "README.rst").write_clean("Spam Spam Spam Spam")
        (tmp_pathplus / "LICENSE").write_clean("This is the license")
        (tmp_pathplus / "requirements.txt").write_clean("domdf_python_tools")

        data = {}

        foreman = Foreman(project_dir=tmp_pathplus)

        with tempfile.TemporaryDirectory() as tmpdir:
                wheel = foreman.build_wheel(
                                build_dir=tmpdir,
                                out_dir=tmp_pathplus,
                                verbose=True,
                                colour=False,
                                )

                assert (tmp_pathplus / wheel).is_file()
                zip_file = zipfile.ZipFile(tmp_pathplus / wheel)
                data["wheel_content"] = sorted(zip_file.namelist())

                with zip_file.open("whey/__init__.py", mode='r') as fp:
                        assert fp.read().decode("UTF-8") == "print('hello world)\n"

                with zip_file.open("whey-2021.0.0.dist-info/METADATA", mode='r') as fp:
                        check_file_regression(fp.read().decode("UTF-8"), file_regression)

                if config != WHEY_NO_PTH:
                        with zip_file.open("my_project.pth", mode='r') as fp:
                                assert fp.read().decode("UTF-8") == "import _virtualenv\n"

        with tempfile.TemporaryDirectory() as tmpdir:
                sdist = foreman.build_sdist(
                                build_dir=tmpdir,
                                out_dir=tmp_pathplus,
                                verbose=True,
                                colour=False,
                                )
                assert (tmp_pathplus / sdist).is_file()

                tar = tarfile.open(tmp_pathplus / sdist)
                data["sdist_content"] = sorted(tar.getnames())

                with tar.extractfile("whey-2021.0.0/whey/__init__.py") as fp:  # type: ignore
                        assert fp.read().decode("UTF-8") == "print('hello world)\n"
                with tar.extractfile("whey-2021.0.0/README.rst") as fp:  # type: ignore
                        assert fp.read().decode("UTF-8") == "Spam Spam Spam Spam\n"
                with tar.extractfile("whey-2021.0.0/LICENSE") as fp:  # type: ignore
                        assert fp.read().decode("UTF-8") == "This is the license\n"
                with tar.extractfile("whey-2021.0.0/requirements.txt") as fp:  # type: ignore
                        assert fp.read().decode("UTF-8") == "domdf_python_tools\n"

        outerr = capsys.readouterr()
        data["stdout"] = outerr.out.replace(tmp_pathplus.as_posix(), "...")
        data["stderr"] = outerr.err

>       advanced_data_regression.check(data)
E    AssertionError: FILES DIFFER:
E    /tmp/pytest-of-tkloczko/pytest-50/test_build_complete_foreman_CO0/test_whey_pth_/test_build_complete_foreman_COMPLETE_A_.yml
E    /tmp/pytest-of-tkloczko/pytest-50/test_build_complete_foreman_CO0/test_whey_pth_/test_build_complete_foreman_COMPLETE_A_.obtained.yml
E    HTML DIFF: /tmp/pytest-of-tkloczko/pytest-50/test_build_complete_foreman_CO0/test_whey_pth_/test_build_complete_foreman_COMPLETE_A_.obtained.diff.html
E    ---
E    +++
E    @@ -15,8 +15,6 @@
E       Writing whey-2021.0.0.dist-info/METADATA
E
E       Writing whey-2021.0.0.dist-info/WHEEL
E    -
E    -  Writing whey-2021.0.0.dist-info/top_level.txt
E
E       Writing my_project.pth
E
E    @@ -46,5 +44,4 @@
E     - whey-2021.0.0.dist-info/RECORD
E     - whey-2021.0.0.dist-info/WHEEL
E     - whey-2021.0.0.dist-info/entry_points.txt
E    -- whey-2021.0.0.dist-info/top_level.txt
E     - whey/__init__.py

tests/test_whey_pth.py:308: AssertionError
_________________________________________________________________ test_build_complete_foreman[COMPLETE_B] __________________________________________________________________

config = '[build-system]\nrequires = [ "whey",]\nbuild-backend = "whey"\n\n[project]\nname = "whey"\nversion = "2021.0.0"\ndesc...whey.builders]\nwheel = "whey_pth_wheel"\n\n[tool.whey-pth]\nname = "my_project"\npth-content = "import _virtualenv"\n'
tmp_pathplus = PosixPathPlus('/tmp/pytest-of-tkloczko/pytest-50/test_build_complete_foreman_CO1')
advanced_data_regression = <coincidence.regressions.AdvancedDataRegressionFixture object at 0x7f0fd5694dc0>
file_regression = <pytest_regressions.file_regression.FileRegressionFixture object at 0x7f0fd5694700>, capsys = <_pytest.capture.CaptureFixture object at 0x7f0fd56941c0>

    @pytest.mark.parametrize(
                "config",
                [
                                pytest.param(WHEY_NO_PTH, id="WHEY_NO_PTH"),
                                pytest.param(COMPLETE_A, id="COMPLETE_A"),
                                pytest.param(COMPLETE_B, id="COMPLETE_B"),
                                ]
                )
    def test_build_complete_foreman(
                config: str,
                tmp_pathplus: PathPlus,
                advanced_data_regression: AdvancedDataRegressionFixture,
                file_regression: FileRegressionFixture,
                capsys,
                ):
        (tmp_pathplus / "pyproject.toml").write_clean(config)
        (tmp_pathplus / "whey").mkdir()
        (tmp_pathplus / "whey" / "__init__.py").write_clean("print('hello world)")
        (tmp_pathplus / "README.rst").write_clean("Spam Spam Spam Spam")
        (tmp_pathplus / "LICENSE").write_clean("This is the license")
        (tmp_pathplus / "requirements.txt").write_clean("domdf_python_tools")

        data = {}

        foreman = Foreman(project_dir=tmp_pathplus)

        with tempfile.TemporaryDirectory() as tmpdir:
                wheel = foreman.build_wheel(
                                build_dir=tmpdir,
                                out_dir=tmp_pathplus,
                                verbose=True,
                                colour=False,
                                )

                assert (tmp_pathplus / wheel).is_file()
                zip_file = zipfile.ZipFile(tmp_pathplus / wheel)
                data["wheel_content"] = sorted(zip_file.namelist())

                with zip_file.open("whey/__init__.py", mode='r') as fp:
                        assert fp.read().decode("UTF-8") == "print('hello world)\n"

                with zip_file.open("whey-2021.0.0.dist-info/METADATA", mode='r') as fp:
                        check_file_regression(fp.read().decode("UTF-8"), file_regression)

                if config != WHEY_NO_PTH:
                        with zip_file.open("my_project.pth", mode='r') as fp:
                                assert fp.read().decode("UTF-8") == "import _virtualenv\n"

        with tempfile.TemporaryDirectory() as tmpdir:
                sdist = foreman.build_sdist(
                                build_dir=tmpdir,
                                out_dir=tmp_pathplus,
                                verbose=True,
                                colour=False,
                                )
                assert (tmp_pathplus / sdist).is_file()

                tar = tarfile.open(tmp_pathplus / sdist)
                data["sdist_content"] = sorted(tar.getnames())

                with tar.extractfile("whey-2021.0.0/whey/__init__.py") as fp:  # type: ignore
                        assert fp.read().decode("UTF-8") == "print('hello world)\n"
                with tar.extractfile("whey-2021.0.0/README.rst") as fp:  # type: ignore
                        assert fp.read().decode("UTF-8") == "Spam Spam Spam Spam\n"
                with tar.extractfile("whey-2021.0.0/LICENSE") as fp:  # type: ignore
                        assert fp.read().decode("UTF-8") == "This is the license\n"
                with tar.extractfile("whey-2021.0.0/requirements.txt") as fp:  # type: ignore
                        assert fp.read().decode("UTF-8") == "domdf_python_tools\n"

        outerr = capsys.readouterr()
        data["stdout"] = outerr.out.replace(tmp_pathplus.as_posix(), "...")
        data["stderr"] = outerr.err

>       advanced_data_regression.check(data)
E    AssertionError: FILES DIFFER:
E    /tmp/pytest-of-tkloczko/pytest-50/test_build_complete_foreman_CO1/test_whey_pth_/test_build_complete_foreman_COMPLETE_B_.yml
E    /tmp/pytest-of-tkloczko/pytest-50/test_build_complete_foreman_CO1/test_whey_pth_/test_build_complete_foreman_COMPLETE_B_.obtained.yml
E    HTML DIFF: /tmp/pytest-of-tkloczko/pytest-50/test_build_complete_foreman_CO1/test_whey_pth_/test_build_complete_foreman_COMPLETE_B_.obtained.diff.html
E    ---
E    +++
E    @@ -15,8 +15,6 @@
E       Writing whey-2021.0.0.dist-info/METADATA
E
E       Writing whey-2021.0.0.dist-info/WHEEL
E    -
E    -  Writing whey-2021.0.0.dist-info/top_level.txt
E
E       Writing my_project.pth
E
E    @@ -46,5 +44,4 @@
E     - whey-2021.0.0.dist-info/RECORD
E     - whey-2021.0.0.dist-info/WHEEL
E     - whey-2021.0.0.dist-info/entry_points.txt
E    -- whey-2021.0.0.dist-info/top_level.txt
E     - whey/__init__.py

tests/test_whey_pth.py:308: AssertionError
_______________________________________________________________________ test_build_additional_files ________________________________________________________________________

tmp_pathplus = PosixPathPlus('/tmp/pytest-of-tkloczko/pytest-50/test_build_additional_files0')
advanced_data_regression = <coincidence.regressions.AdvancedDataRegressionFixture object at 0x7f0fd56ae730>
file_regression = <pytest_regressions.file_regression.FileRegressionFixture object at 0x7f0fd56ae820>, capsys = <_pytest.capture.CaptureFixture object at 0x7f0fd56ae8e0>

    def test_build_additional_files(
                tmp_pathplus: PathPlus,
                advanced_data_regression: AdvancedDataRegressionFixture,
                file_regression: FileRegressionFixture,
                capsys,
                ):

        (tmp_pathplus / "pyproject.toml").write_lines([
                        COMPLETE_A,
                        '',
                        "additional-wheel-files = [",
                        '  "include _virtualenv.py",',
                        ']',
                        ])
        (tmp_pathplus / "whey").mkdir()
        (tmp_pathplus / "whey" / "__init__.py").write_clean("print('hello world)")
        (tmp_pathplus / "_virtualenv.py").write_clean("This is the _virtualenv.py file")
        (tmp_pathplus / "README.rst").write_clean("Spam Spam Spam Spam")
        (tmp_pathplus / "LICENSE").write_clean("This is the license")
        (tmp_pathplus / "requirements.txt").write_clean("domdf_python_tools")

        data = {}

        with tempfile.TemporaryDirectory() as tmpdir:
                wheel_builder = PthWheelBuilder(
                                project_dir=tmp_pathplus,
                                config=load_toml(tmp_pathplus / "pyproject.toml"),
                                build_dir=tmpdir,
                                out_dir=tmp_pathplus,
                                verbose=True,
                                colour=False,
                                )
                wheel = wheel_builder.build_wheel()
                assert (tmp_pathplus / wheel).is_file()
                zip_file = zipfile.ZipFile(tmp_pathplus / wheel)
                data["wheel_content"] = sorted(zip_file.namelist())

                with zip_file.open("whey/__init__.py", mode='r') as fp:
                        assert fp.read().decode("UTF-8") == "print('hello world)\n"

                with zip_file.open("whey-2021.0.0.dist-info/METADATA", mode='r') as fp:
                        check_file_regression(fp.read().decode("UTF-8"), file_regression)

                with zip_file.open("my_project.pth", mode='r') as fp:
                        assert fp.read().decode("UTF-8") == "import _virtualenv\n"

                with zip_file.open("_virtualenv.py", mode='r') as fp:
                        assert fp.read().decode("UTF-8") == "This is the _virtualenv.py file\n"

        outerr = capsys.readouterr()
        data["stdout"] = outerr.out.replace(tmp_pathplus.as_posix(), "...")
        data["stderr"] = outerr.err

>       advanced_data_regression.check(data)
E    AssertionError: FILES DIFFER:
E    /tmp/pytest-of-tkloczko/pytest-50/test_build_additional_files0/test_whey_pth_/test_build_additional_files.yml
E    /tmp/pytest-of-tkloczko/pytest-50/test_build_additional_files0/test_whey_pth_/test_build_additional_files.obtained.yml
E    HTML DIFF: /tmp/pytest-of-tkloczko/pytest-50/test_build_additional_files0/test_whey_pth_/test_build_additional_files.obtained.diff.html
E    ---
E    +++
E    @@ -8,8 +8,6 @@
E       Writing whey-2021.0.0.dist-info/METADATA
E
E       Writing whey-2021.0.0.dist-info/WHEEL
E    -
E    -  Writing whey-2021.0.0.dist-info/top_level.txt
E
E       Writing my_project.pth
E
E    @@ -28,5 +26,4 @@
E     - whey-2021.0.0.dist-info/RECORD
E     - whey-2021.0.0.dist-info/WHEEL
E     - whey-2021.0.0.dist-info/entry_points.txt
E    -- whey-2021.0.0.dist-info/top_level.txt
E     - whey/__init__.py

tests/test_whey_pth.py:364: AssertionError
=========================================================================== slowest 25 durations ===========================================================================
0.06s call     tests/test_whey_pth.py::test_build_complete[WHEY_NO_PTH]
0.04s call     tests/test_whey_pth.py::test_build_complete[COMPLETE_A]
0.04s call     tests/test_whey_pth.py::test_build_complete[COMPLETE_B]
0.03s call     tests/test_whey_pth.py::test_build_complete_foreman[COMPLETE_B]
0.03s call     tests/test_whey_pth.py::test_build_complete_foreman[COMPLETE_A]
0.03s call     tests/test_whey_pth.py::test_build_complete_foreman[WHEY_NO_PTH]
0.02s call     tests/test_whey_pth.py::test_build_additional_files

(18 durations < 0.005s hidden.  Use -vv to show these durations.)
========================================================================= short test summary info ==========================================================================
FAILED tests/test_whey_pth.py::test_build_complete[WHEY_NO_PTH] - AssertionError: FILES DIFFER:
FAILED tests/test_whey_pth.py::test_build_complete[COMPLETE_A] - AssertionError: FILES DIFFER:
FAILED tests/test_whey_pth.py::test_build_complete[COMPLETE_B] - AssertionError: FILES DIFFER:
FAILED tests/test_whey_pth.py::test_build_complete_foreman[WHEY_NO_PTH] - AssertionError: FILES DIFFER:
FAILED tests/test_whey_pth.py::test_build_complete_foreman[COMPLETE_A] - AssertionError: FILES DIFFER:
FAILED tests/test_whey_pth.py::test_build_complete_foreman[COMPLETE_B] - AssertionError: FILES DIFFER:
FAILED tests/test_whey_pth.py::test_build_additional_files - AssertionError: FILES DIFFER:
======================================================================= 7 failed, 2 passed in 0.69s ========================================================================

Here is list of modules installed in build env

Package                       Version
----------------------------- -----------------
alabaster                     0.7.12
apeye                         1.2.0
appdirs                       1.4.4
attrs                         22.1.0
autodocsumm                   0.2.9
Babel                         2.10.2
beautifulsoup4                4.10.0
build                         0.8.0
CacheControl                  0.12.11
charset-normalizer            2.1.0
click                         8.1.2
codespell                     2.1.0
coincidence                   0.6.2
consolekit                    1.4.1
cssutils                      2.5.1
deprecation                   2.1.0
deprecation-alias             0.3.1
dict2css                      0.3.0
dist-meta                     0.5.0
distro                        1.7.0
docutils                      0.18.1
dom_toml                      0.6.0
domdf-python-tools            3.2.2.post1
extras                        1.0.0
fixtures                      4.0.0
gpg                           1.17.1-unknown
handy-archives                0.1.2
html5lib                      1.1
idna                          3.3
imagesize                     1.4.1
importlib-metadata            4.12.0
iniconfig                     1.1.1
Jinja2                        3.1.1
libcomps                      0.1.18
lockfile                      0.12.2
MarkupSafe                    2.1.1
mistletoe                     0.8.2
msgpack                       1.0.4
natsort                       8.0.2
packaging                     21.3
pbr                           5.9.0
pep517                        0.12.0
pip                           22.2.1
platformdirs                  2.5.2
pluggy                        1.0.0
py                            1.11.0
Pygments                      2.12.0
PyGObject                     3.42.2
pyparsing                     3.0.9
pyproject-parser              0.5.0
pytest                        7.1.2
pytest-datadir                1.3.1
pytest-regressions            2.3.1
pytest-timeout                2.1.0
python-dateutil               2.8.2
pytz                          2022.1
PyYAML                        6.0
requests                      2.28.1
rpm                           4.17.0
ruamel.yaml                   0.17.21
ruamel.yaml.clib              0.2.6
setuptools                    63.4.2
shippinglabel                 1.0.1
six                           1.16.0
snowballstemmer               2.2.0
soupsieve                     2.3.2.post1
Sphinx                        5.1.1
sphinx-autodoc-typehints      1.19.1
sphinx-jinja2-compat          0.1.2
sphinx-prompt                 1.4.0
sphinx-pyproject              0.1.0
sphinx-tabs                   3.4.1
sphinx-toolbox                3.1.2
sphinxcontrib-applehelp       1.0.2.dev20220730
sphinxcontrib-devhelp         1.0.2.dev20220730
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1.dev20220730
sphinxcontrib-qthelp          1.0.3.dev20220730
sphinxcontrib-serializinghtml 1.1.5
tabulate                      0.8.9
testtools                     2.5.0
toml                          0.10.2
tomli                         2.0.1
trove-classifiers             2022.7.30
typing_extensions             4.2.0
urllib3                       1.26.9
webencodings                  0.5.1
wheel                         0.37.1
whey                          0.0.23
zipp                          3.8.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.