Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests failing on Windows #1

Closed
jaraco opened this issue Aug 30, 2024 · 8 comments
Closed

Tests failing on Windows #1

jaraco opened this issue Aug 30, 2024 · 8 comments

Comments

@jaraco
Copy link
Member

jaraco commented Aug 30, 2024

For some reason, the tests are failing on Windows:

_______________ [doctest] coherent.deps.imports.Import.builtin ________________
048 
049         Is this import built-in (part of the stdandard library)?
050 
051         An import is built-in if it's top-level name is importable
052         without any third-party packages.
053 
054         >>> Import('requests').builtin()
UNEXPECTED EXCEPTION: OSError(22, 'The parameter is incorrect', None, 87, None)
Traceback (most recent call last):
  File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\doctest.py", line 1334, in __run
    exec(compile(example.source, filename, "single",
  File "<doctest coherent.deps.imports.Import.builtin[0]>", line 1, in <module>
  File "D:\a\coherent.deps\coherent.deps\imports.py", line 63, in builtin
    return self._check_builtin(self.split('.')[0])
  File "C:\Users\RUNNER~1\AppData\Local\Temp\pip-run-4ie898z4\jaraco\context\__init__.py", line 285, in wrapper
    func(*args, **kwargs)
  File "D:\a\coherent.deps\coherent.deps\imports.py", line 72, in _check_builtin
    subprocess.check_call(cmd, env={}, stderr=subprocess.DEVNULL)
  File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\subprocess.py", line 368, in check_call
    retcode = call(*popenargs, **kwargs)
  File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\subprocess.py", line 349, in call
    with Popen(*popenargs, **kwargs) as p:
  File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
OSError: [WinError 87] The parameter is incorrect
D:\a\coherent.deps\coherent.deps\imports.py:54: UnexpectedException
@jaraco
Copy link
Member Author

jaraco commented Aug 31, 2024

When I run the tests on my windows machine, the tests pass, but then the run fails during teardown with an error in coh.test.

@jaraco
Copy link
Member Author

jaraco commented Aug 31, 2024

Since the tests are passing on my machine, I'm now suspicious that subprocess.check_call(stderr=subprocess.DEVNULL) is not allowed on GitHub actions.

Shame on Windows for that terrible error message.

@jaraco
Copy link
Member Author

jaraco commented Aug 31, 2024

I'm seeing other users have a similar issue relating to the extension they added to their executable, unrelated to stderr or devnull.

@jaraco
Copy link
Member Author

jaraco commented Aug 31, 2024

Here's another issue with that error implicating the environment variables. Now this feels familiar. I seem to recall that in some environments, it's unsafe to remove all environment variables.

@jaraco
Copy link
Member Author

jaraco commented Aug 31, 2024

thonny/thonny#2509 looks related, but it's unclear to me which of the changes in the fixed release are implicated. Maybe the executable= parameter to the subprocess call?

@jaraco
Copy link
Member Author

jaraco commented Aug 31, 2024

The value of sys.executable (C:\Program Files (x86)\pipx\.cache\b92d1f6b10f4bb5\Scripts\python.exe) looks perfectly reasonable, so the issue must be the stderr or env parameters.

@jaraco
Copy link
Member Author

jaraco commented Aug 31, 2024

Removing the env={} allows that test to run but fail:

054         >>> Import('requests').builtin()
Expected:
    False
Got:
    True

So probably the issue pertains to some missing but required variable.

@jaraco
Copy link
Member Author

jaraco commented Aug 31, 2024

Simply removing PYTHONPATH from the env allows the test to pass.

I've found python/cpython#120836, which addresses the underlying issue more directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant