diff options
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/fetch.py')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/fetch.py | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/meta/lib/oeqa/selftest/cases/fetch.py b/meta/lib/oeqa/selftest/cases/fetch.py index 67e85d3e4c..cd15f65129 100644 --- a/meta/lib/oeqa/selftest/cases/fetch.py +++ b/meta/lib/oeqa/selftest/cases/fetch.py | |||
@@ -55,25 +55,26 @@ MIRRORS_forcevariable = "git://.*/.* http://downloads.yoctoproject.org/mirror/so | |||
55 | 55 | ||
56 | 56 | ||
57 | class Dependencies(OESelftestTestCase): | 57 | class Dependencies(OESelftestTestCase): |
58 | def write_recipe(self, content): | 58 | def write_recipe(self, content, tempdir): |
59 | f = tempfile.NamedTemporaryFile(mode="wt", suffix=".bb") | 59 | f = os.path.join(tempdir, "test.bb") |
60 | f.write(content) | 60 | with open(f, "w") as fd: |
61 | f.flush() | 61 | fd.write(content) |
62 | return f | 62 | return f |
63 | 63 | ||
64 | def test_dependencies(self): | 64 | def test_dependencies(self): |
65 | """ | 65 | """ |
66 | Verify that the correct dependencies are generated for specific SRC_URI entries. | 66 | Verify that the correct dependencies are generated for specific SRC_URI entries. |
67 | """ | 67 | """ |
68 | with bb.tinfoil.Tinfoil() as tinfoil: | 68 | |
69 | with bb.tinfoil.Tinfoil() as tinfoil, tempfile.TemporaryDirectory(prefix="selftest-fetch") as tempdir: | ||
69 | tinfoil.prepare(config_only=False, quiet=2) | 70 | tinfoil.prepare(config_only=False, quiet=2) |
70 | 71 | ||
71 | r = """ | 72 | r = """ |
72 | LICENSE="CLOSED" | 73 | LICENSE="CLOSED" |
73 | SRC_URI="http://example.com/tarball.zip" | 74 | SRC_URI="http://example.com/tarball.zip" |
74 | """ | 75 | """ |
75 | f = self.write_recipe(textwrap.dedent(r)) | 76 | f = self.write_recipe(textwrap.dedent(r), tempdir) |
76 | d = tinfoil.parse_recipe_file(f.name) | 77 | d = tinfoil.parse_recipe_file(f) |
77 | self.assertIn("wget-native", d.getVarFlag("do_fetch", "depends")) | 78 | self.assertIn("wget-native", d.getVarFlag("do_fetch", "depends")) |
78 | self.assertIn("unzip-native", d.getVarFlag("do_unpack", "depends")) | 79 | self.assertIn("unzip-native", d.getVarFlag("do_unpack", "depends")) |
79 | 80 | ||
@@ -82,8 +83,8 @@ class Dependencies(OESelftestTestCase): | |||
82 | LICENSE="CLOSED" | 83 | LICENSE="CLOSED" |
83 | SRC_URI="https://example.com/tarball;downloadfilename=something.zip" | 84 | SRC_URI="https://example.com/tarball;downloadfilename=something.zip" |
84 | """ | 85 | """ |
85 | f = self.write_recipe(textwrap.dedent(r)) | 86 | f = self.write_recipe(textwrap.dedent(r), tempdir) |
86 | d = tinfoil.parse_recipe_file(f.name) | 87 | d = tinfoil.parse_recipe_file(f) |
87 | self.assertIn("wget-native", d.getVarFlag("do_fetch", "depends")) | 88 | self.assertIn("wget-native", d.getVarFlag("do_fetch", "depends")) |
88 | self.assertIn("unzip-native", d.getVarFlag("do_unpack", "depends") or "") | 89 | self.assertIn("unzip-native", d.getVarFlag("do_unpack", "depends") or "") |
89 | 90 | ||
@@ -91,8 +92,8 @@ class Dependencies(OESelftestTestCase): | |||
91 | LICENSE="CLOSED" | 92 | LICENSE="CLOSED" |
92 | SRC_URI="ftp://example.com/tarball.lz" | 93 | SRC_URI="ftp://example.com/tarball.lz" |
93 | """ | 94 | """ |
94 | f = self.write_recipe(textwrap.dedent(r)) | 95 | f = self.write_recipe(textwrap.dedent(r), tempdir) |
95 | d = tinfoil.parse_recipe_file(f.name) | 96 | d = tinfoil.parse_recipe_file(f) |
96 | self.assertIn("wget-native", d.getVarFlag("do_fetch", "depends")) | 97 | self.assertIn("wget-native", d.getVarFlag("do_fetch", "depends")) |
97 | self.assertIn("lzip-native", d.getVarFlag("do_unpack", "depends")) | 98 | self.assertIn("lzip-native", d.getVarFlag("do_unpack", "depends")) |
98 | 99 | ||
@@ -100,6 +101,6 @@ class Dependencies(OESelftestTestCase): | |||
100 | LICENSE="CLOSED" | 101 | LICENSE="CLOSED" |
101 | SRC_URI="git://example.com/repo" | 102 | SRC_URI="git://example.com/repo" |
102 | """ | 103 | """ |
103 | f = self.write_recipe(textwrap.dedent(r)) | 104 | f = self.write_recipe(textwrap.dedent(r), tempdir) |
104 | d = tinfoil.parse_recipe_file(f.name) | 105 | d = tinfoil.parse_recipe_file(f) |
105 | self.assertIn("git-native", d.getVarFlag("do_fetch", "depends")) | 106 | self.assertIn("git-native", d.getVarFlag("do_fetch", "depends")) |