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

twisted.internet.test.test_process.*.test_openFileDescriptors fails in nixpkgs #11686

Closed
tjni opened this issue Sep 24, 2022 · 0 comments · Fixed by #11687
Closed

twisted.internet.test.test_process.*.test_openFileDescriptors fails in nixpkgs #11686

tjni opened this issue Sep 24, 2022 · 0 comments · Fixed by #11687
Labels

Comments

@tjni
Copy link
Contributor

tjni commented Sep 24, 2022

Describe the incorrect behavior you saw

When the nixpkgs package manager builds and tests twisted, the following two tests fails:

twisted.internet.test.test_process.ProcessTestsBuilder_AsyncioSelectorReactorTests.test_openFileDescriptors
twisted.internet.test.test_process.ProcessTestsBuilder_SelectReactorTests.test_openFileDescriptors

Describe how to cause this behavior

It happens all of the time (but the only machine I have verified this on is my M1 Mac), but I only know how to reproduce it inside of nixpkgs at the moment. You can do so by installing the nix package manager and running:

nix build nixpkgs/staging-next#python310Packages.twisted --extra-experimental-features "nix-command flakes"

However, this is only reproducible currently on the staging or staging-next branches, which contain changes to core packages, and, due to how nix works, hundreds of packages require being rebuilt taking several hours. (Once changes move to the nixpkgs-unstable branch, they will be built and cached in a binary cache.)

Testing environment

❯ sw_vers                                                                                                                             took 26s
ProductName:    macOS
ProductVersion: 12.6
BuildVersion:   21G115
❯ twist --version
22.8.0

Additional context

The root cause is that executing the source defined for that test results in:

Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File "/nix/store/pvfxk0gw5nb276gqhb2xj5w24w67zwgi-python3.10-twisted-22.8.0/lib/python3.10/site-packages/twisted/__init__.py", line 10, in <module>
    from twisted._version import __version__ as version
  File "/nix/store/pvfxk0gw5nb276gqhb2xj5w24w67zwgi-python3.10-twisted-22.8.0/lib/python3.10/site-packages/twisted/_version.py", line 8, in <module>
    from incremental import Version\nModuleNotFoundError: No module named \'incremental\'

Indeed, there is nothing else in that site-packages directory except for twisted. My guess is that the build in nixpkgs adds test dependencies specified to PYTHONPATH instead of using virtual environments.

From looking at the code, I think that a solution (which I have verified fixes the issue in nixpkgs) is to emulate the other tests in that file and pass properEnvs to the spawned process. I will create a PR illustrating this and attach it to this issue, but please feel free to reject it if you think it isn't the right way to resolve this.

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

Successfully merging a pull request may close this issue.

1 participant