diff --git a/dist/coursebox_testing-0.0.4-py3-none-any.whl b/dist/coursebox_testing-0.0.4-py3-none-any.whl new file mode 100644 index 0000000000000000000000000000000000000000..682187d524c7dbf262da14f3d2ac1097aba55c7f Binary files /dev/null and b/dist/coursebox_testing-0.0.4-py3-none-any.whl differ diff --git a/dist/coursebox_testing-0.0.4.tar.gz b/dist/coursebox_testing-0.0.4.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..68cae0a4239ad93bdedc5abb61de0d37061a66a8 Binary files /dev/null and b/dist/coursebox_testing-0.0.4.tar.gz differ diff --git a/dist/coursebox_testing-0.0.5-py3-none-any.whl b/dist/coursebox_testing-0.0.5-py3-none-any.whl new file mode 100644 index 0000000000000000000000000000000000000000..08b8241af526bd067c3f2918b2b1e0a0a227ba0e Binary files /dev/null and b/dist/coursebox_testing-0.0.5-py3-none-any.whl differ diff --git a/dist/coursebox_testing-0.0.5.tar.gz b/dist/coursebox_testing-0.0.5.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..948c64903a428f73273f1966d13ea78dc21ce01d Binary files /dev/null and b/dist/coursebox_testing-0.0.5.tar.gz differ diff --git a/dist/coursebox_testing-0.1.0-py3-none-any.whl b/dist/coursebox_testing-0.1.0-py3-none-any.whl new file mode 100644 index 0000000000000000000000000000000000000000..b2b828d3450243caf2b694369b65d7d2311cbaa5 Binary files /dev/null and b/dist/coursebox_testing-0.1.0-py3-none-any.whl differ diff --git a/dist/coursebox_testing-0.1.0.tar.gz b/dist/coursebox_testing-0.1.0.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..8e01652f51a8fe70ffd9e79bb3ca7be97eade700 Binary files /dev/null and b/dist/coursebox_testing-0.1.0.tar.gz differ diff --git a/requirements.txt b/requirements.txt index 9e98f0e6326f0384f833040341f94c9a537040bc..daa9fbf6b21ad399dc8fe99e7662540c0bd0f133 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ tabulate pydocstyle darglint -interrogate \ No newline at end of file +interrogate diff --git a/setup.py b/setup.py index 8b7f890dbbb68ea3582fa1aa72dfd1a3d57e2624..f2b0d3d68ae2672a6f8b8381d011a52d99cd2906 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ with open("README.md", "r", encoding="utf-8") as fh: setuptools.setup( name="coursebox_testing", - version="0.0.3", + version="0.1.0", author="Tue Herlau", author_email="tuhe@dtu.dk", description="A course management system currently used at DTU (testing software)", diff --git a/src/coursebox_testing.egg-info/PKG-INFO b/src/coursebox_testing.egg-info/PKG-INFO index 4b3dd8ab6cd27c15686fa77a2fc3ae335be97884..c2216ec10f9c1d925feee3f1a1c12143a7f1cb1c 100644 --- a/src/coursebox_testing.egg-info/PKG-INFO +++ b/src/coursebox_testing.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 -Name: coursebox-testing -Version: 0.0.3 +Name: coursebox_testing +Version: 0.1.0 Summary: A course management system currently used at DTU (testing software) Home-page: https://lab.compute.dtu.dk/tuhe/coursebox_testing Author: Tue Herlau @@ -13,22 +13,28 @@ Classifier: Operating System :: OS Independent Requires-Python: >=3.8 Description-Content-Type: text/markdown License-File: LICENSE +Requires-Dist: unitgrade +Requires-Dist: tabulate +Requires-Dist: pydocstyle +Requires-Dist: darglint -# Coursebox DTU (testing tools) -DTU course management software (testing plugins) +# Coursebox DTU +DTU course management software. ## Installation ```terminal -pip install git+https://gitlab.compute.dtu.dk/tuhe/coursebox_testing +pip install coursebox_testing ``` +## Usage +Lightweight testing framework. ## Citing ```bibtex -@online{coursebox, - title={Coursebox (0.1.1): \texttt{pip install coursebox}}, - url={https://lab.compute.dtu.dk/tuhe/coursebox}, - urldate = {2021-09-07}, +@online{coursebox_testing, + title={Coursebox_testing (0.0.3): \texttt{pip install coursebox_testing}}, + url={https://lab.compute.dtu.dk/tuhe/coursebox_testing}, + urldate = {2023-07-15}, month={9}, publisher={Technical University of Denmark (DTU)}, author={Tue Herlau}, diff --git a/src/coursebox_testing/__pycache__/__init__.cpython-311.pyc b/src/coursebox_testing/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cb07a3524436c168970ebe50c272682b5987478c Binary files /dev/null and b/src/coursebox_testing/__pycache__/__init__.cpython-311.pyc differ diff --git a/src/coursebox_testing/testing/__pycache__/__init__.cpython-311.pyc b/src/coursebox_testing/testing/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a54daab617b9aa0c5213055bb97a77116eb0aa27 Binary files /dev/null and b/src/coursebox_testing/testing/__pycache__/__init__.cpython-311.pyc differ diff --git a/src/coursebox_testing/testing/__pycache__/testing.cpython-311.pyc b/src/coursebox_testing/testing/__pycache__/testing.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ed30ef86b238a5f876435c78c871610552c3fb25 Binary files /dev/null and b/src/coursebox_testing/testing/__pycache__/testing.cpython-311.pyc differ diff --git a/src/coursebox_testing/testing/testing.py b/src/coursebox_testing/testing/testing.py index 681e7482e4a24125c7d8f66fbb957f9614e6f04d..255a243cffcd89bf3a5083c241942b6839cf48c2 100644 --- a/src/coursebox_testing/testing/testing.py +++ b/src/coursebox_testing/testing/testing.py @@ -1,3 +1,5 @@ +from pydocstyle.checker import check +import fnmatch from subprocess import run import subprocess import time @@ -102,22 +104,32 @@ def check_py_script(student_dir, module): # raise e # return p, total, out -def check_pyhon_documentation_in_student_repo(student_dir_complete=None, package="cp"): + +def check_pyhon_documentation_in_student_repo(student_dir_complete=None, package="cp", exclude=None): + if exclude is None: + exclude = [] if student_dir_complete is None: + assert False # It is important to not import cp_box here during CI/CD. The coursebox packages is not/should not be installed. - from cp_box import cp_main + # from irlc? import cp_main from coursebox.core.info_paths import get_paths paths = get_paths() student_dir_complete = paths['02450students'] + "_complete" # At this point, also set up the studnets_complete repo. - from cp_box.material.build_documentation import deploy_students_complete + # from cp_box.material.build_documentation import deploy_students_complete + from coursebox.material.documentation import deploy_students_complete deploy_students_complete() - from pydocstyle.checker import check + n = 0 files_ = glob.glob(f"{student_dir_complete}/{package}/ex*/*.py", recursive=True) + glob.glob(f"{student_dir_complete}/{package}/project*/*.py", recursive=True) files_ = [f for f in files_ if not f.endswith("_grade.py")] + files_ = [f for f in files_ if not any([fnmatch.fnmatch(f, pat) for pat in exclude] ) ] + # for f in files_: + # print(f) + + files = [] for f in files_: with open(f, "r") as ff: @@ -189,7 +201,7 @@ def check_pyhon_documentation_in_student_repo(student_dir_complete=None, package return n -def _run_student_tests(student_dir_base=None, weeks=None, projects=None, fail_if_no_projects=True, +def _run_student_tests(student_dir_base=None, weeks : dict=None, projects : dict=None, fail_if_no_projects=True, fail_if_no_weeks=True): """ TODO: Refactor this function to accept full module paths of tests as input, and move the cp.* specific stuff out. Possibly alternative is to automatically search for tests @@ -197,18 +209,34 @@ def _run_student_tests(student_dir_base=None, weeks=None, projects=None, fail_if """ # still got that common module. Eventually this should be an argument (probably). - from cp_box.common import projects_all - from cp_box.common import weeks_all + if projects is None: - projects = projects_all - else: - projects = {k: v for k, v in projects_all.items() if k in projects} + from coursebox.core.info_paths import core_conf + projects = core_conf['projects_all'] + # from irlc_box.common import projects_all + # projects = projects_all + # else: + # projects = {k: v for k, v in projects_all.items() if k in projects} if weeks is None: - weeks = weeks_all - else: - weeks = {k: v for k, v in weeks_all.items() if k in weeks} + from coursebox.core.info_paths import core_conf + weeks = core_conf['weeks_all'] + # from cp_box.common import weeks_all + # weeks = weeks_all + # else: + # weeks = {k: v for k, v in weeks_all.items() if k in weeks} + + # if projects is None: + # from coursebox.core.info_paths import core_conf + # projects = list(core_conf['projects_all'].keys()) + + # if weeks is None: + # weeks_all = core_conf['weeks_all'] + # weeks = weeks_all + # else: + # pass + # weeks = {k: weeks_all[k] for k in weeks} # if projects is None: # from coursebox.core.info_paths import core_conf @@ -231,7 +259,7 @@ def _run_student_tests(student_dir_base=None, weeks=None, projects=None, fail_if bases = {k: projects[k]['module_public'] for k in projects} # f"cp.project{k}.project{k}_tests" for k in projects if True} - bases_weekly = [weeks[k]['module_public'] for k in weeks] # f'cp.tests.tests_week{k:02d}' for k in weeks] + bases_weekly = [weeks[k]['module_public'] for k in weeks if 'module_public' in weeks[k]] # f'cp.tests.tests_week{k:02d}' for k in weeks] if fail_if_no_weeks and len(bases_weekly) == 0: raise Exception("No weeks found. Bad configuration.")