Skip to content

bpo-36160: Fix test_site so that it can run independently of other tests #12131

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

Merged
merged 8 commits into from
May 20, 2021

Conversation

native-api
Copy link
Contributor

@native-api native-api commented Mar 1, 2019

Copy link
Contributor

@remilapeyre remilapeyre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @native-api, thanks for the patch but it looks like it has been fixed in another PR:

./python -m test.test_site
................s.s.........ss
----------------------------------------------------------------------
Ran 30 tests in 0.581s

OK (skipped=4)

I think we can close this one.

@native-api
Copy link
Contributor Author

@remilapeyre I still see the reported error in branches 3.7, 3.8, 3.9 and master in win64.

@remilapeyre
Copy link
Contributor

@remilapeyre I still see the reported error in branches 3.7, 3.8, 3.9 and master in win64.

Sorry, it was a mistake :/

@@ -49,6 +49,8 @@ def setUpModule():
raise unittest.SkipTest('unable to create user site directory (%r): %s'
% (site.USER_SITE, exc))

# sysconfig._CONFIG_VARS is None until the first call to this function
sysconfig.get_config_vars()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to guard the sysconfig._CONFIG_VARS.clear() call in tearDown rather than add an unnecessary initialization.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. Accessing sysconfig._CONFIG_VARS directly is an unsupported operation -- so it's the job of whoever does it to make sure that it works in all cases.

native-api and others added 3 commits May 20, 2021 06:11
Accessing _CONFIG_VARS directly is unsupported so it's the job of whoever does
that to ensure that it works in all cases
@iritkatriel iritkatriel changed the title bpo-36160: Fix AttributeError on sysconfig._CONFIG_VARS.clear() if test_site is run separately bpo-36160: Fix test_site so that it can run independently of other tests May 20, 2021
@iritkatriel iritkatriel added needs backport to 3.9 only security fixes needs backport to 3.10 only security fixes labels May 20, 2021
@iritkatriel iritkatriel merged commit 1270ad6 into python:main May 20, 2021
@miss-islington
Copy link
Contributor

Thanks @native-api for the PR, and @iritkatriel for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.9.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 20, 2021
@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label May 20, 2021
@bedevere-bot
Copy link

GH-26262 is a backport of this pull request to the 3.10 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 20, 2021
@bedevere-bot
Copy link

GH-26263 is a backport of this pull request to the 3.9 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label May 20, 2021
iritkatriel pushed a commit that referenced this pull request May 20, 2021
iritkatriel pushed a commit that referenced this pull request May 20, 2021
@native-api native-api deleted the test_site_configvars branch May 20, 2021 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants