MagicStack / MagicStack/uvloop

test_process_env_2 not portable to non-FHS systems

Ouverte
#647 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
Cython
Étoiles
11.9k
Forks
616
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

  • uvloop version: 0.21.0
  • Python version: 3.10
  • Platform: GNU Guix

This test code:

    def test_process_env_2(self):
        async def test():
            cmd = 'env'
            env = {}  # empty environment
            proc = await asyncio.create_subprocess_exec(
                cmd,
                env=env,
                stdout=subprocess.PIPE,
                stderr=subprocess.PIPE)

            out, _ = await proc.communicate()
            self.assertEqual(out, b'')
            self.assertEqual(proc.returncode, 0)

        self.loop.run_until_complete(test())

fails like:

=================================== FAILURES ===================================
______________________ Test_UV_Process.test_process_env_2 ______________________
Traceback (most recent call last):
  File "/gnu/store/jjcka1g6sk2cvwx8nm4fdwpdq3vll0v0-python-3.10.7/lib/python3.10/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/gnu/store/jjcka1g6sk2cvwx8nm4fdwpdq3vll0v0-python-3.10.7/lib/python3.10/unittest/case.py", line 591, in run
    self._callTestMethod(testMethod)
  File "/gnu/store/jjcka1g6sk2cvwx8nm4fdwpdq3vll0v0-python-3.10.7/lib/python3.10/unittest/case.py", line 549, in _callTestMethod
    method()
  File "/tmp/guix-build-python-uvloop-0.21.0.drv-0/uvloop-0.21.0/tests/test_process.py", line 67, in test_process_env_2
    self.loop.run_until_complete(test())
  File "uvloop/loop.pyx", line 1518, in uvloop.loop.Loop.run_until_complete
  File "/tmp/guix-build-python-uvloop-0.21.0.drv-0/uvloop-0.21.0/tests/test_process.py", line 57, in test
    proc = await asyncio.create_subprocess_exec(
  File "/gnu/store/jjcka1g6sk2cvwx8nm4fdwpdq3vll0v0-python-3.10.7/lib/python3.10/asyncio/subprocess.py", line 218, in create_subprocess_exec
    transport, protocol = await loop.subprocess_exec(
  File "uvloop/loop.pyx", line 2841, in subprocess_exec
  File "uvloop/loop.pyx", line 2799, in __subprocess_run
  File "uvloop/handles/process.pyx", line 611, in uvloop.loop.UVProcessTransport.new
  File "uvloop/dns.pyx", line 112, in uvloop.loop.__convert_pyaddr_to_sockaddr
FileNotFoundError: [Errno 2] No such file or directory
_____________________ Test_AIO_Process.test_process_env_2 ______________________
Traceback (most recent call last):
  File "/gnu/store/jjcka1g6sk2cvwx8nm4fdwpdq3vll0v0-python-3.10.7/lib/python3.10/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/gnu/store/jjcka1g6sk2cvwx8nm4fdwpdq3vll0v0-python-3.10.7/lib/python3.10/unittest/case.py", line 591, in run
    self._callTestMethod(testMethod)
  File "/gnu/store/jjcka1g6sk2cvwx8nm4fdwpdq3vll0v0-python-3.10.7/lib/python3.10/unittest/case.py", line 549, in _callTestMethod
    method()
  File "/tmp/guix-build-python-uvloop-0.21.0.drv-0/uvloop-0.21.0/tests/test_process.py", line 67, in test_process_env_2
    self.loop.run_until_complete(test())
  File "/gnu/store/jjcka1g6sk2cvwx8nm4fdwpdq3vll0v0-python-3.10.7/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/tmp/guix-build-python-uvloop-0.21.0.drv-0/uvloop-0.21.0/tests/test_process.py", line 57, in test
    proc = await asyncio.create_subprocess_exec(
  File "/gnu/store/jjcka1g6sk2cvwx8nm4fdwpdq3vll0v0-python-3.10.7/lib/python3.10/asyncio/subprocess.py", line 218, in create_subprocess_exec
    transport, protocol = await loop.subprocess_exec(
  File "/gnu/store/jjcka1g6sk2cvwx8nm4fdwpdq3vll0v0-python-3.10.7/lib/python3.10/asyncio/base_events.py", line 1667, in subprocess_exec
    transport = await self._make_subprocess_transport(
  File "/gnu/store/jjcka1g6sk2cvwx8nm4fdwpdq3vll0v0-python-3.10.7/lib/python3.10/asyncio/unix_events.py", line 207, in _make_subprocess_transport
    transp = _UnixSubprocessTransport(self, protocol, args, shell,
  File "/gnu/store/jjcka1g6sk2cvwx8nm4fdwpdq3vll0v0-python-3.10.7/lib/python3.10/asyncio/base_subprocess.py", line 36, in __init__
    self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
  File "/gnu/store/jjcka1g6sk2cvwx8nm4fdwpdq3vll0v0-python-3.10.7/lib/python3.10/asyncio/unix_events.py", line 799, in _start
    self._proc = subprocess.Popen(
  File "/gnu/store/jjcka1g6sk2cvwx8nm4fdwpdq3vll0v0-python-3.10.7/lib/python3.10/subprocess.py", line 969, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/gnu/store/jjcka1g6sk2cvwx8nm4fdwpdq3vll0v0-python-3.10.7/lib/python3.10/subprocess.py", line 1845, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'env'

This is because on non-file-hierarchy-standard systems like GNU Guix and Nix, env is not found at some fixed location burnt on the implicit PATH value; instead it must be looked from PATH, but the tests clears it.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par tests/test_process.py et les cas test_process_env_2 présentés dans le rapport, en comparant les échecs de uvloop et asyncio sur GNU Guix. Faites en sorte que le test localise l’exécutable env sans dépendre d’un PATH implicite fixe, puis vérifiez que les deux implémentations se terminent correctement, avec une sortie vide et un code de retour 0, sur les systèmes qui ne sont pas FHS.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
operating-systems, testing-qa
Type d'issue
Bug
Difficulté
2/5
Temps estimé
1-3 heures
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.