1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-24 22:06:14 +01:00

Move _get_fixture() to OscTestCase class

This commit is contained in:
Daniel Mach 2022-08-23 14:28:57 +02:00
parent 00956cf13a
commit 1c581fdf2c
2 changed files with 5 additions and 3 deletions

View File

@ -223,6 +223,11 @@ class OscTestCase(unittest.TestCase):
def _get_fixtures_dir(self):
raise NotImplementedError('subclasses should implement this method')
def _get_fixture(self, filename):
path = os.path.join(self._get_fixtures_dir(), filename)
with open(path) as f:
return f.read()
def _change_to_pkg(self, name):
os.chdir(os.path.join(self.tmpdir, 'osctest', name))

View File

@ -28,9 +28,6 @@ class TestResults(OscTestCase):
cli.main(argv=argv)
return sys.stdout.getvalue()
def _get_fixture(self, filename):
return open(os.path.join(self._get_fixtures_dir(), filename)).read()
@GET('http://localhost/build/testproject/_result', file='result.xml')
def testPrjresults(self):
out = self._run_osc('prjresults', '--xml', 'testproject')