You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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-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.0rootdir: /home/tkloczko/rpmbuild/BUILD/versioningit-3.1.0configfile: tox.iniplugins: mock-3.14.0collected 534 itemstest/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.typeE AssertionError: assert 'NotSdistError' == 'NoTagError'EE - NoTagErrorE + NotSdistErrortest/test_end2end.py:249: AssertionError------------------------------------------------------------------------------------- Captured log call -------------------------------------------------------------------------------------DEBUG versioningit:methods.py:60 Loading entry point 'hg' in group versioningit.vcsDEBUG versioningit:methods.py:60 Loading entry point 'basic' in group versioningit.tag2versionDEBUG versioningit:methods.py:60 Loading entry point 'minor' in group versioningit.next_versionDEBUG versioningit:methods.py:60 Loading entry point 'basic' in group versioningit.formatDEBUG versioningit:methods.py:60 Loading entry point 'basic' in group versioningit.template_fieldsDEBUG 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 repositoryINFO 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 = <Popen: returncode: 1 args: ['/usr/bin/python3', 'setup.py', 'develop']>, stdout = Nonestderr = None, retcode = 1 def run(*popenargs, input=None, capture_output=False, timeout=None, check=False, **kwargs): """Run command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr. By default, stdout and stderr are not captured, and those attributes will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them. If check is True and the exit code was non-zero, it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute, and output & stderr attributes if those streams were captured. If timeout is given, and the process takes too long, a TimeoutExpired exception will be raised. There is an optional argument "input", allowing you to pass bytes or a string to the subprocess's stdin. If you use this argument you may not also use the Popen constructor's "stdin" argument, as it will be used internally. By default, all communication is in bytes, and therefore any "input" should be bytes, and the stdout and stderr will be bytes. If in text mode, any "input" should be a string, and stdout and stderr will be strings decoded according to locale encoding, or by "encoding" if set. Text mode is triggered by setting any of text, encoding, errors or universal_newlines. The other arguments are the same as for the Popen constructor. """ if input is not None: if kwargs.get('stdin') is not None: raise ValueError('stdin and input arguments may not both be used.') kwargs['stdin'] = PIPE if capture_output: if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None: raise ValueError('stdout and stderr arguments may not be used ' 'with capture_output.') kwargs['stdout'] = PIPE kwargs['stderr'] = PIPE with Popen(*popenargs, **kwargs) as process: try: stdout, stderr = process.communicate(input, timeout=timeout) except TimeoutExpired as exc: process.kill() if _mswindows: # Windows accumulates the output in a single blocking # read() call run on child threads, with the timeout # being done in a join() on those threads. communicate() # _after_ kill() is required to collect that and add it # to the exception. exc.stdout, exc.stderr = process.communicate() else: # POSIX _communicate already populated the output so # far into the TimeoutExpired exception. process.wait() raise except: # Including KeyboardInterrupt, communicate handled that. process.kill() # We don't call process.wait() as .__exit__ does that for us. raise retcode = process.poll() if check and retcode:
> raise CalledProcessError(retcode, process.args, output=stdout, stderr=stderr)E subprocess.CalledProcessError: Command '['/usr/bin/python3', 'setup.py', 'develop']' returned non-zero exit status 1./usr/lib64/python3.9/subprocess.py:528: CalledProcessError----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------running develop----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------/usr/lib/python3.9/site-packages/setuptools/command/develop.py:40: EasyInstallDeprecationWarning: easy_install command is deprecated.!! ******************************************************************************** Please avoid running ``setup.py`` and ``easy_install``. Instead, use pypa/build, pypa/installer or other standards-based tools. See https://github.com/pypa/setuptools/issues/917 for details. ********************************************************************************!! easy_install.initialize_options(self)/usr/lib/python3.9/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.!! ******************************************************************************** Please avoid running ``setup.py`` directly. Instead, use pypa/build, pypa/installer or other standards-based tools. See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details. ********************************************************************************!! self.initialize_options()error: can't create or remove files in install directoryThe following error occurred while trying to add or remove files in theinstallation directory: [Errno 13] Permission denied: '/usr/lib/python3.9/site-packages/test-easy-install-3661377.write-test'The installation directory you specified (via --install-dir, --prefix, orthe distutils default setting) was: /usr/lib/python3.9/site-packages/Perhaps your account does not have write access to this directory? If theinstallation directory is a system-owned directory, you may need to sign inas the administrator or "root" account. If you do not have administrativeaccess to this machine, you may wish to choose a different installationdirectory, preferably one that is listed in your PYTHONPATH environmentvariable.For information on other options, you may wish to consult thedocumentation at: https://setuptools.pypa.io/en/latest/deprecated/easy_install.htmlPlease make the appropriate changes for your system and try again.------------------------------------------------------------------------------------- Captured log call -------------------------------------------------------------------------------------DEBUG versioningit:util.py:64 Running: git status --porcelain================================================================================== short test summary info ==================================================================================SKIPPED [1] test/test_end2end.py:96: Only run when --oldsetup is givenSKIPPED [9] test/test_end2end.py:96: Mercurial not installedSKIPPED [1] test/test_methods/test_git.py:309: Git must not be installedSKIPPED [6] test/test_methods/test_hg.py:34: Mercurial not installedSKIPPED [1] test/test_methods/test_hg.py:70: Mercurial not installedSKIPPED [1] test/test_methods/test_hg.py:84: Mercurial not installedSKIPPED [2] test/test_methods/test_hg.py:91: Mercurial not installedSKIPPED [1] test/test_methods/test_hg.py:100: Mercurial not installedSKIPPED [1] test/test_methods/test_hg.py:110: Mercurial not installedSKIPPED [1] test/test_methods/test_hg.py:139: Mercurial not installedSKIPPED [1] test/test_methods/test_hg.py:149: Mercurial not installedSKIPPED [1] test/test_util.py:146: Windows onlyFAILED test/test_end2end.py::test_end2end_error[errors/hg-no-tag] - AssertionError: assert 'NotSdistError' == 'NoTagError'FAILED test/test_end2end.py::test_editable_mode[cmd1] - subprocess.CalledProcessError: Command '['/usr/bin/python3', 'setup.py', 'develop']' returned non-zero exit status 1.=================================================================== 2 failed, 506 passed, 26 skipped in 84.23s (0:01:24) ====================================================================
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:
List of installed modules in build env:
Please let me know if you need more details or want me to perform some diagnostics.
The text was updated successfully, but these errors were encountered: