From 98bf9f9dea2c075d0a31bf2fdab18120c6b17a3d Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Fri, 20 May 2016 08:57:47 -0400 Subject: [PATCH 1/4] Enable concurrency (but not randomization) in LMS unit tests --- pavelib/utils/test/suites/nose_suite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pavelib/utils/test/suites/nose_suite.py b/pavelib/utils/test/suites/nose_suite.py index 61d2225552..7d63ffbb88 100644 --- a/pavelib/utils/test/suites/nose_suite.py +++ b/pavelib/utils/test/suites/nose_suite.py @@ -128,7 +128,7 @@ class SystemTestSuite(NoseTestSuite): if self.processes is None: # Use one process per core for LMS tests, and no multiprocessing # otherwise. - self.processes = 0 + self.processes = -1 if self.root == 'lms' else 0 self.processes = int(self.processes) From a7ed99ba7965571f5cf6e67ff0e7d88ce737d6e8 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Thu, 9 Jun 2016 14:00:11 -0400 Subject: [PATCH 2/4] Add __init__.py to tests folders to make them proper modules --- common/djangoapps/cache_toolbox/tests/__init__.py | 0 common/djangoapps/header_control/tests/__init__.py | 0 common/lib/i18n/__init__.py | 0 lms/djangoapps/verified_track_content/tests/__init__.py | 0 openedx/core/djangoapps/models/tests/__init__.py | 0 5 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 common/djangoapps/cache_toolbox/tests/__init__.py create mode 100644 common/djangoapps/header_control/tests/__init__.py create mode 100644 common/lib/i18n/__init__.py create mode 100644 lms/djangoapps/verified_track_content/tests/__init__.py create mode 100644 openedx/core/djangoapps/models/tests/__init__.py diff --git a/common/djangoapps/cache_toolbox/tests/__init__.py b/common/djangoapps/cache_toolbox/tests/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/common/djangoapps/header_control/tests/__init__.py b/common/djangoapps/header_control/tests/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/common/lib/i18n/__init__.py b/common/lib/i18n/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lms/djangoapps/verified_track_content/tests/__init__.py b/lms/djangoapps/verified_track_content/tests/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/openedx/core/djangoapps/models/tests/__init__.py b/openedx/core/djangoapps/models/tests/__init__.py new file mode 100644 index 0000000000..e69de29bb2 From e7caf9b0ca97636c61e975d796b505617aba2679 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Thu, 9 Jun 2016 15:25:37 -0400 Subject: [PATCH 3/4] Rename i18n.tests to i18n_tests, so that the i18n.tests package can be a package without squashing the python i18n package namespace --- common/lib/i18n/tests/__init__.py | 0 common/lib/{i18n => i18n_tests}/__init__.py | 0 .../lib/{i18n/tests => i18n_tests}/test_extract_and_generate.py | 0 3 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 common/lib/i18n/tests/__init__.py rename common/lib/{i18n => i18n_tests}/__init__.py (100%) rename common/lib/{i18n/tests => i18n_tests}/test_extract_and_generate.py (100%) diff --git a/common/lib/i18n/tests/__init__.py b/common/lib/i18n/tests/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/common/lib/i18n/__init__.py b/common/lib/i18n_tests/__init__.py similarity index 100% rename from common/lib/i18n/__init__.py rename to common/lib/i18n_tests/__init__.py diff --git a/common/lib/i18n/tests/test_extract_and_generate.py b/common/lib/i18n_tests/test_extract_and_generate.py similarity index 100% rename from common/lib/i18n/tests/test_extract_and_generate.py rename to common/lib/i18n_tests/test_extract_and_generate.py From a173270ef1c98072eeafe6cfcc4699c1dfcab5bf Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Thu, 9 Jun 2016 16:25:55 -0400 Subject: [PATCH 4/4] Fix pylint-identified issues in i18n_tests --- common/lib/i18n_tests/test_extract_and_generate.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/common/lib/i18n_tests/test_extract_and_generate.py b/common/lib/i18n_tests/test_extract_and_generate.py index 96a73bf736..6766b9ef55 100644 --- a/common/lib/i18n_tests/test_extract_and_generate.py +++ b/common/lib/i18n_tests/test_extract_and_generate.py @@ -28,6 +28,8 @@ class TestGenerate(TestCase): @classmethod def setUpClass(cls): + super(TestGenerate, cls).setUpClass() + sys.stderr.write( "\nThis test tests that i18n extraction (`paver i18n_extract`) works properly. " "If you experience failures, please check that all instances of `gettext` and " @@ -53,6 +55,8 @@ class TestGenerate(TestCase): super(TestGenerate, cls).tearDownClass() def setUp(self): + super(TestGenerate, self).setUp() + # Subtract 1 second to help comparisons with file-modify time succeed, # since os.path.getmtime() is not millisecond-accurate self.start_time = datetime.now(UTC) - timedelta(seconds=1) @@ -83,8 +87,9 @@ class TestGenerate(TestCase): path = os.path.join(CONFIGURATION.get_messages_dir(locale), mofile) exists = os.path.exists(path) self.assertTrue(exists, msg='Missing file in locale %s: %s' % (locale, mofile)) - self.assertTrue( - datetime.fromtimestamp(os.path.getmtime(path), UTC) >= self.start_time, + self.assertGreaterEqual( + datetime.fromtimestamp(os.path.getmtime(path), UTC), + self.start_time, msg='File not recently modified: %s' % path ) # Segmenting means that the merge headers don't work they way they