Skip to content

Make tests never use normal cache/config dir - #283

Merged
eteq merged 5 commits into
astropy:masterfrom
eteq:tests/dont-use-config-dir
Jun 15, 2012
Merged

eteq merged 5 commits into
astropy:masterfrom
eteq:tests/dont-use-config-dir

Conversation

@eteq

@eteq eteq commented Jun 14, 2012

Copy link
Copy Markdown
Member

This overwrites the environment variables used to specify the configuration and cache directories so that running the tests doesn't have any chance of messing with those directories. Instead, they get redirectred to temporary directories. Before this, even though the config tests don't write to them, they were still read for configuration information, which might mess up tests in some cases.

This closes #134 and closes #196

Comment thread astropy/tests/helper.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you mean distutils instead of sphinx?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

good point - fixed

@astrofrog

Copy link
Copy Markdown
Member

@eteq - since I fell a bit behind on understanding this, could you explain briefly what is happening here - specifically, are you distinguishing between running tests via:

python setup.py test

and

astropy.test()

?

Why do the temporary environment variables only need to be set in one case?

@eteq

eteq commented Jun 14, 2012

Copy link
Copy Markdown
Member Author

@astrofrog - Yeah, it's a bit confusing - in both cases, the environment variables that override the cache/config dirs are replaced by temporary directories while the tests are running.

The difference is that in the setup.py test case, this environment variable is applied before the py.test process is started. This is needed because just importing the astropy test runner will create the config directory. In contrast, for astropy.test(), we override the envars only temporarily when the tests start, and then restore them after the tests finish (because we still want to maintain the users' settings).

So the result for the tests is the same (config and cache dirs are temporary dirs), but the implementation is different due to the before/after needs.

@eteq

eteq commented Jun 14, 2012

Copy link
Copy Markdown
Member Author

If there are no objections, I'll merge this at the end of the day.

Comment thread astropy/tests/helper.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

just spotted another typo - sphinx

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fixed

eteq added a commit that referenced this pull request Jun 15, 2012
Make tests never use normal cache/config dir
@eteq
eteq merged commit 00a60d4 into astropy:master Jun 15, 2012
keflavich pushed a commit to keflavich/astropy that referenced this pull request Oct 9, 2013
Make tests never use normal cache/config dir
@eteq
eteq deleted the tests/dont-use-config-dir branch May 3, 2015 17:16
astrofrog pushed a commit to astrofrog/astropy that referenced this pull request Jun 12, 2019
Running cron build for only one version
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.

Tests create .astropy directory Use a temporary directory for $HOME/.astropy in config tests

2 participants