diff options
author | Benjamin Schubert <bschubert15@bloomberg.net> | 2020-08-29 14:08:52 +0000 |
---|---|---|
committer | Benjamin Schubert <bschubert15@bloomberg.net> | 2020-12-01 10:58:01 +0000 |
commit | 0360bc1feca1d5429cdb7fbc083727d242499733 (patch) | |
tree | a8f7e8e465584c8170264fed6030d0812a722bcc | |
parent | 11b2aa717718b315d005ab5b29b56ec521424528 (diff) | |
download | buildstream-0360bc1feca1d5429cdb7fbc083727d242499733.tar.gz |
downloadablefilesource.py: Reset the file opener between every test
This is required when we run this in the main process, with the threaded
scheduler rework.
Otherwise the state is kept between tests
-rw-r--r-- | src/buildstream/downloadablefilesource.py | 5 | ||||
-rw-r--r-- | src/buildstream/testing/_fixtures.py | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/buildstream/downloadablefilesource.py b/src/buildstream/downloadablefilesource.py index 2c438b033..495b8bd4a 100644 --- a/src/buildstream/downloadablefilesource.py +++ b/src/buildstream/downloadablefilesource.py @@ -252,6 +252,11 @@ class DownloadableFileSource(Source): return self.__default_mirror_file + @classmethod + def _reset_url_opener(cls): + # Needed for tests, in order to cleanup the `netrc` configuration. + cls.__urlopener = None + def __get_urlopener(self): if not DownloadableFileSource.__urlopener: try: diff --git a/src/buildstream/testing/_fixtures.py b/src/buildstream/testing/_fixtures.py index 98778936d..520f68587 100644 --- a/src/buildstream/testing/_fixtures.py +++ b/src/buildstream/testing/_fixtures.py @@ -19,7 +19,7 @@ import psutil import pytest -from buildstream import node, utils +from buildstream import node, utils, DownloadableFileSource @pytest.fixture(autouse=True, scope="session") @@ -42,3 +42,4 @@ def thread_check(default_thread_number): @pytest.fixture(autouse=True) def reset_global_node_state(): node._reset_global_state() + DownloadableFileSource._reset_url_opener() |