Skip to content

Commit

Permalink
fix flake8 and missing inject_python_repo
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan Cheung <nathan.cheung.451@outlook.com>
Signed-off-by: Fabrice Macagno <fabrice.macagno@al.com.au>
  • Loading branch information
nca45 authored and fabal committed Jul 4, 2024
1 parent bd74553 commit 96f40e3
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/rez/tests/test_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@
from rez.resolved_context import ResolvedContext
from rez.package_test import PackageTestRunner


class TestTest(TestBase, TempdirMixin):
@classmethod
def setUpClass(cls):
TempdirMixin.setUpClass()

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()
Expand All @@ -34,24 +36,28 @@ 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")

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
)

0 comments on commit 96f40e3

Please sign in to comment.