Loading tests/test_runner/test_discover_runner.py +17 −3 Original line number Diff line number Diff line from contextlib import contextmanager import os from django.test import TestCase from django.test.runner import DiscoverRunner Loading Loading @@ -61,6 +64,17 @@ class DiscoverRunnerTest(TestCase): self.assertEqual(count, 1) def test_file_path(self): @contextmanager def change_cwd_to_tests(): """Change CWD to tests directory (one level up from this file)""" current_dir = os.path.abspath(os.path.dirname(__file__)) tests_dir = os.path.join(current_dir, '..') old_cwd = os.getcwd() os.chdir(tests_dir) yield os.chdir(old_cwd) with change_cwd_to_tests(): count = DiscoverRunner().build_suite( ["test_discovery_sample/"], ).countTestCases() Loading Loading
tests/test_runner/test_discover_runner.py +17 −3 Original line number Diff line number Diff line from contextlib import contextmanager import os from django.test import TestCase from django.test.runner import DiscoverRunner Loading Loading @@ -61,6 +64,17 @@ class DiscoverRunnerTest(TestCase): self.assertEqual(count, 1) def test_file_path(self): @contextmanager def change_cwd_to_tests(): """Change CWD to tests directory (one level up from this file)""" current_dir = os.path.abspath(os.path.dirname(__file__)) tests_dir = os.path.join(current_dir, '..') old_cwd = os.getcwd() os.chdir(tests_dir) yield os.chdir(old_cwd) with change_cwd_to_tests(): count = DiscoverRunner().build_suite( ["test_discovery_sample/"], ).countTestCases() Loading