Open kloczek opened 7 months ago
The test_end2end_error[errors/hg-no-tag]
test is failing because it requires Mercurial to be installed, but the test isn't correctly marked as requiring Mercurial (If it had been marked correctly, the test would have been skippped). I'll fix this in a bit.
The test_editable_mode[cmd1]
test is failing because the test tries to run setup.py develop
on a test project, and setuptools on your machine then tries to install the test project in /usr/lib/python3.9/site-packages/
, which it doesn't have write access to. This test (and several others) is intended to be run in a virtual environment in order to avoid permission issues like this.
I have just released versioningit v3.1.1, containing a fix for the test_end2end_error[errors/hg-no-tag]
issue. Are you still having problems with the test_editable_mode[cmd1]
test?
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
build
with--no-isolation
I'm using during all processes only locally installed modulesinstaller
modulecut off from access to the public network
(pytest is executed with-m "not network"
)Here is pytest output:
```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-versioningit-3.1.0-2.fc36.x86_64/usr/lib64/python3.9/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-versioningit-3.1.0-2.fc36.x86_64/usr/lib/python3.9/site-packages + /usr/bin/pytest -ra -m 'not network' ==================================================================================== test session starts ==================================================================================== platform linux -- Python 3.9.18, pytest-8.1.1, pluggy-1.4.0 rootdir: /home/tkloczko/rpmbuild/BUILD/versioningit-3.1.0 configfile: tox.ini plugins: mock-3.14.0 collected 534 items test/test_config.py .................... [ 3%] test/test_end2end.py .............s.................................sssssssss...........F........F.. [ 18%] test/test_get_version.py .. [ 18%] test/test_logging.py ........................................... [ 26%] test/test_main.py .......................... [ 31%] test/test_methods/test_format.py ......... [ 33%] test/test_methods/test_git.py ............................s [ 38%] test/test_methods/test_hg.py sssssss.sssssss...... [ 42%] test/test_methods/test_next_version.py ..................................................................................................... [ 61%] test/test_methods/test_onbuild.py ....................................... [ 69%] test/test_methods/test_tag2version.py ............. [ 71%] test/test_methods/test_template_fields.py ................ [ 74%] test/test_methods/test_write.py ........ [ 76%] test/test_util.py ...........................................s.................................................................................... [100%] ========================================================================================= FAILURES ========================================================================================== ___________________________________________________________________________ test_end2end_error[errors/hg-no-tag] ____________________________________________________________________________ tmp_path = PosixPath('/tmp/pytest-of-tkloczko/pytest-228/test_end2end_error_errors_hg_n0') repozip = PosixPath('/home/tkloczko/rpmbuild/BUILD/versioningit-3.1.0/test/data/repos/errors/hg-no-tag.zip') details = ErrorDetails(type='NoTagError', message="No latest tag in Mercurial repository (pattern = 're:^v')") @pytest.mark.parametrize( "repozip,details", mkcases("errors", [needs_git], details_cls=ErrorDetails) ) def test_end2end_error(tmp_path: Path, repozip: Path, details: ErrorDetails) -> None: shutil.unpack_archive(repozip, tmp_path) with pytest.raises(Error) as excinfo: get_version(project_dir=tmp_path, write=False, fallback=True) > assert type(excinfo.value).__name__ == details.type E AssertionError: assert 'NotSdistError' == 'NoTagError' E E - NoTagError E + NotSdistError test/test_end2end.py:249: AssertionError ------------------------------------------------------------------------------------- Captured log call ------------------------------------------------------------------------------------- DEBUG versioningit:methods.py:60 Loading entry point 'hg' in group versioningit.vcs DEBUG versioningit:methods.py:60 Loading entry point 'basic' in group versioningit.tag2version DEBUG versioningit:methods.py:60 Loading entry point 'minor' in group versioningit.next_version DEBUG versioningit:methods.py:60 Loading entry point 'basic' in group versioningit.format DEBUG versioningit:methods.py:60 Loading entry point 'basic' in group versioningit.template_fields DEBUG versioningit:util.py:64 Running: hg --cwd /tmp/pytest-of-tkloczko/pytest-228/test_end2end_error_errors_hg_n0 files . INFO versioningit:core.py:280 Could not get VCS data from /tmp/pytest-of-tkloczko/pytest-228/test_end2end_error_errors_hg_n0: hg not installed; assuming this isn't a Mercurial repository INFO versioningit:core.py:281 Falling back to reading from PKG-INFO _________________________________________________________________________________ test_editable_mode[cmd1] __________________________________________________________________________________ cmd = ['setup.py', 'develop'], tmp_path = PosixPath('/tmp/pytest-of-tkloczko/pytest-228/test_editable_mode_cmd1_0') @needs_git @pytest.mark.parametrize( "cmd", [ ["-m", "pip", "install", "--no-build-isolation", "-e", "."], ["setup.py", "develop"], ], ) def test_editable_mode(cmd: list[str], tmp_path: Path) -> None: repozip = DATA_DIR / "repos" / "git" / "onbuild-write.zip" details = CaseDetails.model_validate_json( repozip.with_suffix(".json").read_text(encoding="utf-8") ) srcdir = tmp_path / "src" shutil.unpack_archive(repozip, srcdir) status = get_repo_status(srcdir) > subprocess.run([sys.executable, *cmd], cwd=str(srcdir), check=True) test/test_end2end.py:374: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ input = None, capture_output = False, timeout = None, check = True, popenargs = (['/usr/bin/python3', 'setup.py', 'develop'],) kwargs = {'cwd': '/tmp/pytest-of-tkloczko/pytest-228/test_editable_mode_cmd1_0/src'}, process =List of installed modules in build env:
```console Package Version ----------------------------- ----------- alabaster 0.7.16 annotated-types 0.6.0 Babel 2.14.0 build 1.1.1 charset-normalizer 3.3.2 docutils 0.20.1 editables 0.5 exceptiongroup 1.1.3 hatchling 1.21.1 idna 3.6 imagesize 1.4.1 importlib_metadata 7.1.0 iniconfig 2.0.0 installer 0.7.0 Jinja2 3.1.3 MarkupSafe 2.1.5 packaging 24.0 pathspec 0.12.1 pluggy 1.4.0 pydantic 2.6.4 pydantic_core 2.16.3 Pygments 2.17.2 pyproject_hooks 1.0.0 pytest 8.1.1 pytest-mock 3.14.0 python-dateutil 2.9.0.post0 requests 2.31.0 setuptools 69.1.1 snowballstemmer 2.2.0 Sphinx 7.2.6 sphinx-copybutton 0.5.2 sphinx_inline_tabs 2023.4.21 sphinxcontrib-applehelp 1.0.8 sphinxcontrib-devhelp 1.0.5 sphinxcontrib-htmlhelp 2.0.5 sphinxcontrib-jsmath 1.0.1 sphinxcontrib-qthelp 1.0.7 sphinxcontrib-serializinghtml 1.1.10 tokenize_rt 5.2.0 tomli 2.0.1 trove-classifiers 2024.3.25 typing_extensions 4.10.0 urllib3 1.26.18 wheel 0.43.0 zipp 3.18.1 ```Please let me know if you need more details or want me to perform some diagnostics.