refactor!: delete common/lib and related usages

This commit is contained in:
UsamaSadiq
2022-08-25 16:31:47 +05:00
committed by Usama Sadiq
parent 96f6174d9e
commit 897cb3617f
40 changed files with 92 additions and 228 deletions

View File

@@ -164,6 +164,8 @@ def python_prereqs_installation():
"""
Installs Python prerequisites
"""
# edx-platform installs some Python projects from within the edx-platform repo itself.
sh(f"pip install -e .")
for req_file in PYTHON_REQ_FILES:
pip_install_req_file(req_file)

View File

@@ -34,7 +34,7 @@ __test__ = False # do not collect
("fasttest", "a", "Run without collectstatic"),
make_option(
"--django_version", dest="django_version",
help="Run against which Django version (1.8, 1.9, 1.10, -or- 1.11)."
help="Run against which Django version (3.2)."
),
make_option(
"--eval-attr", dest="eval_attr",
@@ -109,7 +109,7 @@ def test_system(options, passthrough_options):
django_version = getattr(options, 'django_version', None)
assert system in (None, 'lms', 'cms')
assert django_version in (None, '1.8', '1.9', '1.10', '1.11')
assert django_version in (None, '3.2')
if hasattr(options.test_system, 'with_wtw'):
call_task('fetch_coverage_test_selection_data', options={
@@ -163,7 +163,7 @@ def test_system(options, passthrough_options):
("fail-fast", "x", "Run only failed tests"),
make_option(
"--django_version", dest="django_version",
help="Run against which Django version (1.8, 1.9, 1.10, -or- 1.11)."
help="Run against which Django version (3.2)."
),
make_option(
"--eval-attr", dest="eval_attr",
@@ -197,20 +197,20 @@ def test_system(options, passthrough_options):
@timed
def test_lib(options, passthrough_options):
"""
Run tests for common/lib/ and pavelib/ (paver-tests)
Run tests for pavelib/ (paver-tests)
"""
lib = getattr(options, 'lib', None)
test_id = getattr(options, 'test_id', lib)
django_version = getattr(options, 'django_version', None)
assert django_version in (None, '1.8', '1.9', '1.10', '1.11')
assert django_version in (None, '3.2')
if test_id:
# Testing a single test id.
if '/' in test_id:
lib = '/'.join(test_id.split('/')[0:3])
else:
lib = 'common/lib/' + test_id.split('.')[0]
lib = 'pavelib/paver_tests' + test_id.split('.')[0]
options.test_lib['test_id'] = test_id
lib_tests = [suites.LibTestSuite(
lib,
@@ -218,7 +218,7 @@ def test_lib(options, passthrough_options):
**options.test_lib
)]
else:
# Testing all common/lib test dirs - plus pavelib.
# Testing all tests within pavelib/paver_tests dir.
lib_tests = [
suites.LibTestSuite(
d,

View File

@@ -209,15 +209,9 @@ class Env:
JS_REPORT_DIR = REPORT_DIR / 'javascript'
# Directories used for common/lib/tests
# Directories used for pavelib/ tests
IGNORED_TEST_DIRS = ('__pycache__', '.cache', '.pytest_cache')
LIB_TEST_DIRS = []
for item in (REPO_ROOT / "common/lib").listdir():
dir_name = (REPO_ROOT / 'common/lib' / item)
if dir_name.isdir() and not dir_name.endswith(IGNORED_TEST_DIRS):
LIB_TEST_DIRS.append(path("common/lib") / item.basename())
LIB_TEST_DIRS.append(path("pavelib/paver_tests"))
LIB_TEST_DIRS.append(path("scripts/xsslint/tests"))
LIB_TEST_DIRS = [path("pavelib/paver_tests"), path("scripts/xsslint/tests")]
# Directory for i18n test reports
I18N_REPORT_DIR = REPORT_DIR / 'i18n'

View File

@@ -260,7 +260,7 @@ class SystemTestSuite(PytestSuite):
class LibTestSuite(PytestSuite):
"""
TestSuite for edx-platform/common/lib python unit tests
TestSuite for edx-platform/pavelib/paver_tests python unit tests
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -321,11 +321,7 @@ class LibTestSuite(PytestSuite):
for rsync_dir in Env.rsync_dirs():
cmd.append(f'--rsyncdir {rsync_dir}')
# "--rsyncdir" throws off the configuration root, set it explicitly
if 'common/lib' in self.test_id:
cmd.append('--rootdir=common/lib')
cmd.append('-c common/lib/pytest.ini')
elif 'pavelib/paver_tests' in self.test_id:
cmd.append('--rootdir=pavelib/paver_tests')
cmd.append('--rootdir=pavelib/paver_tests')
else:
if self.processes == -1:
cmd.append('-n auto')

View File

@@ -37,7 +37,7 @@ class PythonTestSuite(TestSuite):
def _default_subsuites(self):
"""
The default subsuites to be run. They include lms, cms,
and all of the libraries in common/lib.
and all of the libraries in pavelib/paver_tests.
"""
lib_suites = [
LibTestSuite(d, **self.opts) for d in Env.LIB_TEST_DIRS