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

"import pendulum" causes unwanted import of pytest (presence of pytest in sys.modules often used to control Python behaviour) #808

Open
2 tasks done
tomjridge opened this issue Feb 15, 2024 · 1 comment

Comments

@tomjridge
Copy link

  • I am on the latest Pendulum version.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • OS version and name: macOS 13.3.1 (a)

  • Pendulum version: 3.0.0

Issue

The following code:

python -c "import sys; import pendulum; print('pytest' in sys.modules)"

prints True. Unfortunately the test 'pytest' in sys.modules is often used to detect whether code is running under pytest or not, and modify code behaviour accordingly (see eg https://pypi.org/project/pytest-is-running/)

Ideally importing pendlum would not cause pytest to be imported.

Is this possible to fix easily?

Thanks for the great work on pendulum!

@tomjridge
Copy link
Author

Seems to be caused by the pypi package "time-machine"

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