MagicStack / MagicStack/uvloop
test_process_env_2 not portable to non-FHS systems
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Cython
- Sterne
- 11.9k
- Forks
- 616
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
- 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.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit tests/test_process.py und den im Bericht gezeigten Fällen test_process_env_2 und vergleiche die uvloop- und asyncio-Fehler unter GNU Guix. Sorge dafür, dass der Test die ausführbare Datei env findet, ohne sich auf einen festen impliziten PATH zu verlassen, und überprüfe anschließend, dass beide Implementierungen auf Nicht-FHS-Systemen erfolgreich mit leerer Ausgabe und Rückgabecode 0 abgeschlossen werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- operating-systems, testing-qa
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100