diff options
| author | Ross Burton <ross.burton@arm.com> | 2025-05-10 09:43:49 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-05-12 22:01:55 +0100 |
| commit | 0fc5716c1192df5180204a8679569c5d91cc0f1b (patch) | |
| tree | 03dbb2da47b9d3d4bd171d73739c298a6a6860bb /meta/lib/oeqa/sdk/cases | |
| parent | 04e4586c66b61891f45438a6ff19d26cfe30d480 (diff) | |
| download | poky-0fc5716c1192df5180204a8679569c5d91cc0f1b.tar.gz | |
oeqa/sdk/maturin: no need for a setupClass, merge code into test
There's no need to copy files inside setUpClass() when there's only one
test function that uses it. Just do all of the test inside the test.
(From OE-Core rev: 5474677b21f2f4069f355abdc600483c42d0b0b3)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/sdk/cases')
| -rw-r--r-- | meta/lib/oeqa/sdk/cases/maturin.py | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/meta/lib/oeqa/sdk/cases/maturin.py b/meta/lib/oeqa/sdk/cases/maturin.py index 83d13c4ec5..e3e8edc781 100644 --- a/meta/lib/oeqa/sdk/cases/maturin.py +++ b/meta/lib/oeqa/sdk/cases/maturin.py | |||
| @@ -30,17 +30,6 @@ class MaturinTest(OESDKTestCase): | |||
| 30 | self.assertIn(expected, output) | 30 | self.assertIn(expected, output) |
| 31 | 31 | ||
| 32 | class MaturinDevelopTest(OESDKTestCase): | 32 | class MaturinDevelopTest(OESDKTestCase): |
| 33 | @classmethod | ||
| 34 | def setUpClass(self): | ||
| 35 | targetdir = os.path.join(self.tc.sdk_dir, "guessing-game") | ||
| 36 | try: | ||
| 37 | shutil.rmtree(targetdir) | ||
| 38 | except FileNotFoundError: | ||
| 39 | pass | ||
| 40 | shutil.copytree( | ||
| 41 | os.path.join(self.tc.files_dir, "maturin/guessing-game"), targetdir | ||
| 42 | ) | ||
| 43 | |||
| 44 | def setUp(self): | 33 | def setUp(self): |
| 45 | machine = self.td.get("MACHINE") | 34 | machine = self.td.get("MACHINE") |
| 46 | self.ensure_host_package("python3-maturin") | 35 | self.ensure_host_package("python3-maturin") |
| @@ -58,9 +47,17 @@ class MaturinDevelopTest(OESDKTestCase): | |||
| 58 | (1) that a .venv can been created. | 47 | (1) that a .venv can been created. |
| 59 | (2) a functional 'rustc' and 'cargo' | 48 | (2) a functional 'rustc' and 'cargo' |
| 60 | """ | 49 | """ |
| 61 | self._run("cd %s/guessing-game; python3 -m venv .venv" % self.tc.sdk_dir) | 50 | targetdir = os.path.join(self.tc.sdk_dir, "guessing-game") |
| 62 | cmd = "cd %s/guessing-game; maturin develop" % self.tc.sdk_dir | 51 | try: |
| 63 | output = self._run(cmd) | 52 | shutil.rmtree(targetdir) |
| 53 | except FileNotFoundError: | ||
| 54 | pass | ||
| 55 | shutil.copytree( | ||
| 56 | os.path.join(self.tc.files_dir, "maturin/guessing-game"), targetdir | ||
| 57 | ) | ||
| 58 | |||
| 59 | self._run("cd %s; python3 -m venv .venv" % targetdir) | ||
| 60 | output = self._run("cd %s; maturin develop" % targetdir) | ||
| 64 | self.assertRegex(output, r"🔗 Found pyo3 bindings with abi3 support for Python ≥ 3.8") | 61 | self.assertRegex(output, r"🔗 Found pyo3 bindings with abi3 support for Python ≥ 3.8") |
| 65 | self.assertRegex(output, r"🐍 Not using a specific python interpreter") | 62 | self.assertRegex(output, r"🐍 Not using a specific python interpreter") |
| 66 | self.assertRegex(output, r"📡 Using build options features from pyproject.toml") | 63 | self.assertRegex(output, r"📡 Using build options features from pyproject.toml") |
