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

move get_version to child process #11

Closed
wants to merge 1 commit into from
Closed

Conversation

javierggt
Copy link
Collaborator

@javierggt javierggt commented Jun 17, 2020

move get_version to child process to prevent environment from being changed as side effect

Description

This issue arised in the context of sot/testr/pull/21.

At the very top of get_version, the module whose version we want is imported. Some modules change the environment, and that can cause undesired effects. One way around it is to get the version in a separate process.

This is not that common. One instance I have seen was importing dea_check, which causes kadi to be imported and adds DJANGO_SETTINGS_MODULE to the environment. The trouble is during testing, where the main process has this import, and then in child processes we get the error:

E           AttributeError: module 'kadi.events' has no attribute 'dwells'

Testing

  • Passes unit tests on MacOS, linux, Windows (at least one required)
  • Functional testing

Fixes #

@javierggt javierggt mentioned this pull request Jun 17, 2020
8 tasks
@taldcroft
Copy link
Member

I assume this is overtaken by #12?

@javierggt
Copy link
Collaborator Author

Yes. overtaken by #12

@javierggt javierggt closed this Jun 25, 2020
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

Successfully merging this pull request may close these issues.

2 participants