jupyterlab / hatch-jupyter-builder

A hatch plugin to help build Jupyter packages
https://hatch-jupyter-builder.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
38 stars 13 forks source link

0.8.3: pytest is failing in `tests/test_plugin.py::test_hatch_build` unit #129

Open kloczek opened 11 months ago

kloczek commented 11 months ago

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.

Here is pytest output:

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-hatch-jupyter-builder-0.8.3-5.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-hatch-jupyter-builder-0.8.3-5.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra -m 'not network' ============================= test session starts ============================== platform linux -- Python 3.8.18, pytest-7.4.2, pluggy-1.3.0 rootdir: /home/tkloczko/rpmbuild/BUILD/hatch-jupyter-builder-0.8.3 configfile: pyproject.toml testpaths: tests/ plugins: mock-3.11.1 collected 33 items tests/test_is_stale.py ............ [ 36%] tests/test_migration.py ss [ 42%] tests/test_npm_builder.py .......... [ 72%] tests/test_plugin.py .F [ 78%] tests/test_utils.py ....... [100%] =================================== FAILURES =================================== _______________________________ test_hatch_build _______________________________ tmp_path = PosixPath('/tmp/pytest-of-tkloczko/pytest-47/test_hatch_build0') @pytest.mark.skipif(platform.python_implementation() == "PyPy", reason="Does not work on PyPy") def test_hatch_build(tmp_path): > venv.create(tmp_path, with_pip=True) /home/tkloczko/rpmbuild/BUILD/hatch-jupyter-builder-0.8.3/tests/test_plugin.py:108: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib64/python3.8/venv/__init__.py:391: in create builder.create(env_dir) /usr/lib64/python3.8/venv/__init__.py:68: in create self._setup_pip(context) /usr/lib64/python3.8/venv/__init__.py:289: in _setup_pip subprocess.check_output(cmd, stderr=subprocess.STDOUT) /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ input = None, capture_output = False, timeout = None, check = True popenargs = (['/tmp/pytest-of-tkloczko/pytest-47/test_hatch_build0/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip'],) kwargs = {'stderr': -2, 'stdout': -1} process = stdout = b'Traceback (most recent call last):\n File "/usr/lib64/python3.8/runpy.py", line 185, in _run_module_as_main\n mo...n\n return str(max(_wheels[pkg], key=distutils.version.LooseVersion))\nValueError: max() arg is an empty sequence\n' stderr = 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 '['/tmp/pytest-of-tkloczko/pytest-47/test_hatch_build0/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1. /usr/lib64/python3.8/subprocess.py:516: CalledProcessError ============================= slowest 10 durations ============================= 0.05s call tests/test_plugin.py::test_hatch_build 0.01s call tests/test_utils.py::test_run (8 durations < 0.005s hidden. Use -vv to show these durations.) =========================== short test summary info ============================ SKIPPED [2] tests/conftest.py:25: Skipping this test because it's marked 'migration_test'. Run integration tests using the `--migration-tests` flag. FAILED tests/test_plugin.py::test_hatch_build - subprocess.CalledProcessError: Command '['/tmp/pytest-of-tkloczko/pytest-47... =================== 1 failed, 30 passed, 2 skipped in 0.41s ==================== ```

Here is list of installed modules in build env

```console Package Version ----------------------------- --------- alabaster 0.7.13 Babel 2.12.1 build 1.0.3 charset-normalizer 3.2.0 distro 1.8.0 docutils 0.20.1 editables 0.5 exceptiongroup 1.1.3 gpg 1.21.0 hatchling 1.18.0 idna 3.4 imagesize 1.4.1 importlib-metadata 6.8.0 iniconfig 2.0.0 installer 0.7.0 Jinja2 3.1.2 libcomps 0.1.19 markdown-it-py 3.0.0 MarkupSafe 2.1.3 mdit-py-plugins 0.4.0 mdurl 0.1.2 myst-parser 2.0.0 packaging 23.1 pathspec 0.11.2 pkg 0.0.0 pluggy 1.3.0 Pygments 2.16.1 pyproject_hooks 1.0.0 pytest 7.4.2 pytest-mock 3.11.1 python-dateutil 2.8.2 pytz 2023.3 PyYAML 6.0.1 requests 2.31.0 six 1.16.0 snowballstemmer 2.2.0 Sphinx 7.0.1 sphinx-autodoc-typehints 1.24.0 sphinxcontrib-applehelp 1.0.4 sphinxcontrib-devhelp 1.0.2 sphinxcontrib-htmlhelp 2.0.3 sphinxcontrib-jsmath 1.0.1 sphinxcontrib-qthelp 1.0.3 sphinxcontrib-serializinghtml 1.1.9 tomli 2.0.1 trove-classifiers 2023.9.19 urllib3 1.26.16 wheel 0.41.1 zipp 3.17.0 ```