test: move api buildroot test to test_buildroot.py
Create a new test suite for BuildRoot related test and move the the combined api and buildroot check there.
This commit is contained in:
parent
41cf4bf2d3
commit
28cea491bd
2 changed files with 48 additions and 28 deletions
|
|
@ -2,15 +2,11 @@
|
|||
# Test for API infrastructure
|
||||
#
|
||||
|
||||
import pathlib
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
import osbuild
|
||||
from osbuild.buildroot import BuildRoot
|
||||
from osbuild.monitor import NullMonitor
|
||||
from osbuild.util import jsoncomm
|
||||
|
||||
|
||||
|
|
@ -69,27 +65,3 @@ class TestAPI(unittest.TestCase):
|
|||
with self.assertRaises(AssertionError):
|
||||
with api:
|
||||
pass
|
||||
|
||||
def test_buildroot(self):
|
||||
# Check API and BuildRoot integration: the runner will call
|
||||
# api.setup_stdio and thus check that connecting to the api
|
||||
# works correctly
|
||||
runner = "org.osbuild.linux"
|
||||
libdir = os.path.abspath(os.curdir)
|
||||
var = pathlib.Path(self.tmp.name, "var")
|
||||
var.mkdir()
|
||||
|
||||
monitor = NullMonitor(sys.stderr.fileno())
|
||||
with BuildRoot("/", runner, libdir=libdir, var=var) as root:
|
||||
api = osbuild.api.API({}, monitor)
|
||||
root.register_api(api)
|
||||
|
||||
r = root.run(["/usr/bin/true"])
|
||||
self.assertEqual(r.returncode, 0)
|
||||
|
||||
# Test we can use `.run` multiple times
|
||||
r = root.run(["/usr/bin/true"])
|
||||
self.assertEqual(r.returncode, 0)
|
||||
|
||||
r = root.run(["/usr/bin/false"])
|
||||
self.assertNotEqual(r.returncode, 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue