Skip to content

Commit

Permalink
tests: Fix TestMirrorGroup to load oscrc from fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
dmach committed Aug 9, 2023
1 parent a581613 commit 7ad815a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/test_grabber.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@
import osc.grabber as osc_grabber


FIXTURES_DIR = os.path.join(os.path.dirname(__file__), "conf_fixtures")


class TestMirrorGroup(unittest.TestCase):
def setUp(self):
self.tmpdir = tempfile.mkdtemp(prefix='osc_test')
# reset the global `config` in preparation for running the tests
importlib.reload(osc.conf)
osc.conf.get_config()
oscrc = os.path.join(self._get_fixtures_dir(), "oscrc")
osc.conf.get_config(override_conffile=oscrc, override_no_keyring=True)

def tearDown(self):
# reset the global `config` to avoid impacting tests from other classes
Expand All @@ -22,6 +26,9 @@ def tearDown(self):
except:
pass

def _get_fixtures_dir(self):
return FIXTURES_DIR

def test_invalid_scheme(self):
gr = osc_grabber.OscFileGrabber()
mg = osc_grabber.OscMirrorGroup(gr, ["container://example.com"])
Expand Down

0 comments on commit 7ad815a

Please sign in to comment.