From 9765bd37c41db8b1d609368392a21d6d387dcd13 Mon Sep 17 00:00:00 2001 From: Nathan Cheung Date: Tue, 2 Jul 2024 21:20:58 -0700 Subject: [PATCH] fix flake8 and missing inject_python_repo Signed-off-by: Nathan Cheung --- src/rez/tests/test_test.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/rez/tests/test_test.py b/src/rez/tests/test_test.py index f150357bd..a049afa47 100644 --- a/src/rez/tests/test_test.py +++ b/src/rez/tests/test_test.py @@ -9,6 +9,7 @@ from rez.resolved_context import ResolvedContext from rez.package_test import PackageTestRunner + class TestTest(TestBase, TempdirMixin): @classmethod def setUpClass(cls): @@ -16,12 +17,13 @@ def setUpClass(cls): packages_path = cls.data_path("builds", "packages") cls.settings = dict( - packages_path = [packages_path], + packages_path=[packages_path], package_filter=None, implicit_packages=[], warn_untimestamped=False, resolve_caching=False ) + @classmethod def tearDownClass(cls): TempdirMixin.tearDownClass() @@ -34,17 +36,18 @@ def test_1(self): def _run_tests(self, r): """Run unit tests in package.py""" + self.inject_python_repo() runner = PackageTestRunner( package_request="testing_obj", package_paths=r.package_paths, stop_on_fail=False, verbose=2 ) - + test_names = runner.get_test_names() for test_name in test_names: - runner.run_test(test_name) + runner.run_test(test_name) successful_test = self._get_test_result(runner, "check_car_ideas") failed_test = self._get_test_result(runner, "move_meeting_to_noon") @@ -52,6 +55,9 @@ def _run_tests(self, r): self.assertEqual(runner.test_results.num_tests, 2) self.assertEqual(successful_test["status"], "success") self.assertEqual(failed_test["status"], "failed") - + def _get_test_result(self, runner, test_name): - return next((result for result in runner.test_results.test_results if result.get("test_name") == test_name), None) + return next( + (result for result in runner.test_results.test_results if result.get("test_name") == test_name), + None + )