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

2021.7.30: boostrapping calver #7

Closed
kloczek opened this issue Apr 9, 2022 · 2 comments · Fixed by #8
Closed

2021.7.30: boostrapping calver #7

kloczek opened this issue Apr 9, 2022 · 2 comments · Fixed by #8

Comments

@kloczek
Copy link

kloczek commented Apr 9, 2022

Looks like calver needs calver on build using pep517 build procedure.

+ /usr/bin/python3 -sBm build -w --no-isolation
* Getting dependencies for wheel...
/usr/lib/python3.8/site-packages/setuptools/_distutils/dist.py:275: UserWarning: Unknown distribution option: 'use_calver'
  warnings.warn(msg)
running egg_info
writing src/calver.egg-info/PKG-INFO
writing dependency_links to src/calver.egg-info/dependency_links.txt
writing entry points to src/calver.egg-info/entry_points.txt
writing top-level names to src/calver.egg-info/top_level.txt
reading manifest file 'src/calver.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE'
writing manifest file 'src/calver.egg-info/SOURCES.txt'

ERROR Missing dependencies:
        calver

How to boostrap calver? 🤔

@kloczek
Copy link
Author

kloczek commented Apr 9, 2022

OK looks like setting env variable PYTHONPATH=$PWD/src allowed me to pass build.
I'm not sure however is it correct procedure.

Nevertheless after that I've hit another issue wiit pytest.
As I'm trying to package your module as an rpm package, and I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account I'm following below steps:

  • 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-calver-2021.7.30-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-calver-2021.7.30-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.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/calver-2021.7.30
collected 7 items

tests/test_integration.py ...FFF.                                                                                                                                    [100%]

================================================================================= FAILURES =================================================================================
____________________________________________________________________________ test_version_true _____________________________________________________________________________

dist = <stub(metadata=<stub(version='2021.7.30')>)>, keyword = <stub()>

    def test_version_true(dist, keyword):
        value = True

        calver.integration.version(dist, keyword, value)

>       assert dist.metadata.version == datetime.datetime.now().strftime(
            calver.integration.DEFAULT_FORMAT
        )
E       AssertionError: assert '2021.7.30' == '2022.04.09'
E         - 2022.04.09
E         + 2021.7.30

tests/test_integration.py:36: AssertionError
_____________________________________________________________________________ test_version_str _____________________________________________________________________________

dist = <stub(metadata=<stub(version='2021.7.30')>)>, keyword = <stub()>

    def test_version_str(dist, keyword):
        value = "%c"

        calver.integration.version(dist, keyword, value)

>       assert dist.metadata.version == datetime.datetime.now().strftime(value)
E       AssertionError: assert '2021.7.30' == 'Sat Apr  9 11:00:28 2022'
E         - Sat Apr  9 11:00:28 2022
E         + 2021.7.30

tests/test_integration.py:46: AssertionError
__________________________________________________________________________ test_version_callable ___________________________________________________________________________

dist = <stub(metadata=<stub(version='2021.7.30')>)>, keyword = <stub()>

    def test_version_callable(dist, keyword):
        v = pretend.stub()
        value = lambda: v

        calver.integration.version(dist, keyword, value)

>       assert dist.metadata.version == v
E       AssertionError: assert '2021.7.30' == <stub()>
E        +  where '2021.7.30' = <stub(version='2021.7.30')>.version
E        +    where <stub(version='2021.7.30')> = <stub(metadata=<stub(version='2021.7.30')>)>.metadata

tests/test_integration.py:55: AssertionError
========================================================================= short test summary info ==========================================================================
FAILED tests/test_integration.py::test_version_true - AssertionError: assert '2021.7.30' == '2022.04.09'
FAILED tests/test_integration.py::test_version_str - AssertionError: assert '2021.7.30' == 'Sat Apr  9 11:00:28 2022'
FAILED tests/test_integration.py::test_version_callable - AssertionError: assert '2021.7.30' == <stub()>
======================================================================= 3 failed, 4 passed in 0.07s ========================================================================

Looks like pytest is testing agains vestion generated from current date.
Temporary I'm going to add above units to --deselect list.

@di
Copy link
Owner

di commented Apr 11, 2022

I think #8 should fix #7 (comment), can you confirm?

$ pip freeze | grep calver

$ python -sBm build -w --no-isolation
* Getting dependencies for wheel...
/home/di/.pyenv/versions/3.11.0a6/lib/python3.11/site-packages/setuptools/dist.py:487: UserWarning: Normalizing '2022.04.11' to '2022.4.11'
  warnings.warn(tmpl.format(**locals()))
running egg_info
writing src/calver.egg-info/PKG-INFO
writing dependency_links to src/calver.egg-info/dependency_links.txt
writing entry points to src/calver.egg-info/entry_points.txt
writing top-level names to src/calver.egg-info/top_level.txt
reading manifest file 'src/calver.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE'
writing manifest file 'src/calver.egg-info/SOURCES.txt'
* Building wheel...
/home/di/.pyenv/versions/3.11.0a6/lib/python3.11/site-packages/setuptools/dist.py:487: UserWarning: Normalizing '2022.04.11' to '2022.4.11'
  warnings.warn(tmpl.format(**locals()))
running bdist_wheel
running build
running build_py
copying src/calver/integration.py -> build/lib/calver
installing to build/bdist.linux-x86_64/wheel
running install
running install_lib
creating build/bdist.linux-x86_64/wheel
creating build/bdist.linux-x86_64/wheel/calver
copying build/lib/calver/__main__.py -> build/bdist.linux-x86_64/wheel/calver
copying build/lib/calver/integration.py -> build/bdist.linux-x86_64/wheel/calver
copying build/lib/calver/__init__.py -> build/bdist.linux-x86_64/wheel/calver
running install_egg_info
running egg_info
writing src/calver.egg-info/PKG-INFO
writing dependency_links to src/calver.egg-info/dependency_links.txt
writing entry points to src/calver.egg-info/entry_points.txt
writing top-level names to src/calver.egg-info/top_level.txt
reading manifest file 'src/calver.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE'
writing manifest file 'src/calver.egg-info/SOURCES.txt'
Copying src/calver.egg-info to build/bdist.linux-x86_64/wheel/calver-2022.4.11-py3.11.egg-info
running install_scripts
adding license file "LICENSE" (matched pattern "LICEN[CS]E*")
creating build/bdist.linux-x86_64/wheel/calver-2022.4.11.dist-info/WHEEL
creating '/home/di/git/di/calver/dist/tmpov3wma9f/calver-2022.4.11-py3-none-any.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
adding 'calver/__init__.py'
adding 'calver/__main__.py'
adding 'calver/integration.py'
adding 'calver-2022.4.11.dist-info/LICENSE'
adding 'calver-2022.4.11.dist-info/METADATA'
adding 'calver-2022.4.11.dist-info/WHEEL'
adding 'calver-2022.4.11.dist-info/entry_points.txt'
adding 'calver-2022.4.11.dist-info/top_level.txt'
adding 'calver-2022.4.11.dist-info/RECORD'
removing build/bdist.linux-x86_64/wheel
Successfully built calver-2022.4.11-py3-none-any.whl

@di di closed this as completed in #8 Jun 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants