Skip to content
Snippets Groups Projects
Commit 3773c2e4 authored by tuhe's avatar tuhe
Browse files

Minor change not on pypi

parent 4e3b61ac
Branches
No related tags found
No related merge requests found
Showing
with 59 additions and 25 deletions
File added
File added
File added
File added
File added
File added
......@@ -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)",
......
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},
......
File added
File added
File added
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.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment