diff options
-rw-r--r-- | meta-selftest/lib/oeqa/runtime/cases/dnf_runtime.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/meta-selftest/lib/oeqa/runtime/cases/dnf_runtime.py b/meta-selftest/lib/oeqa/runtime/cases/dnf_runtime.py index 123e7259f1..68e56f2c5e 100644 --- a/meta-selftest/lib/oeqa/runtime/cases/dnf_runtime.py +++ b/meta-selftest/lib/oeqa/runtime/cases/dnf_runtime.py | |||
@@ -6,6 +6,8 @@ class DnfSelftest(DnfTest): | |||
6 | 6 | ||
7 | @classmethod | 7 | @classmethod |
8 | def setUpClass(cls): | 8 | def setUpClass(cls): |
9 | import tempfile | ||
10 | cls.temp_dir = tempfile.TemporaryDirectory(prefix="oeqa-remotefeeds-") | ||
9 | cls.repo_server = HTTPService(os.path.join(cls.tc.td['WORKDIR'], 'oe-rootfs-repo'), | 11 | cls.repo_server = HTTPService(os.path.join(cls.tc.td['WORKDIR'], 'oe-rootfs-repo'), |
10 | cls.tc.target.server_ip) | 12 | cls.tc.target.server_ip) |
11 | cls.repo_server.start() | 13 | cls.repo_server.start() |
@@ -13,6 +15,7 @@ class DnfSelftest(DnfTest): | |||
13 | @classmethod | 15 | @classmethod |
14 | def tearDownClass(cls): | 16 | def tearDownClass(cls): |
15 | cls.repo_server.stop() | 17 | cls.repo_server.stop() |
18 | cls.temp_dir.cleanup() | ||
16 | 19 | ||
17 | @OETestDepends(['dnf.DnfBasicTest.test_dnf_help']) | 20 | @OETestDepends(['dnf.DnfBasicTest.test_dnf_help']) |
18 | def test_verify_package_feeds(self): | 21 | def test_verify_package_feeds(self): |
@@ -25,11 +28,11 @@ class DnfSelftest(DnfTest): | |||
25 | """ | 28 | """ |
26 | # When we created an image, we had to supply fake ip and port | 29 | # When we created an image, we had to supply fake ip and port |
27 | # for the feeds. Now we can patch the real ones into the config file. | 30 | # for the feeds. Now we can patch the real ones into the config file. |
28 | import tempfile | 31 | temp_file = os.path.join(self.temp_dir.name, 'tmp.repo') |
29 | temp_file = tempfile.TemporaryDirectory(prefix="oeqa-remotefeeds-").name | ||
30 | self.tc.target.copyFrom("/etc/yum.repos.d/oe-remote-repo.repo", temp_file) | 32 | self.tc.target.copyFrom("/etc/yum.repos.d/oe-remote-repo.repo", temp_file) |
31 | fixed_config = open(temp_file, "r").read().replace("bogus_ip", self.tc.target.server_ip).replace("bogus_port", str(self.repo_server.port)) | 33 | fixed_config = open(temp_file, "r").read().replace("bogus_ip", self.tc.target.server_ip).replace("bogus_port", str(self.repo_server.port)) |
32 | open(temp_file, "w").write(fixed_config) | 34 | with open(temp_file, "w") as f: |
35 | f.write(fixed_config) | ||
33 | self.tc.target.copyTo(temp_file, "/etc/yum.repos.d/oe-remote-repo.repo") | 36 | self.tc.target.copyTo(temp_file, "/etc/yum.repos.d/oe-remote-repo.repo") |
34 | 37 | ||
35 | import re | 38 | import re |