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:
```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 ====================
```
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 modulescut off from access to the public network
(pytest is executed with-m "not network"
)Here is pytest output:
Here is list of installed modules in build env