From 5576b58949fd920b64d051565f66303ed869d90b Mon Sep 17 00:00:00 2001 From: Tim Schubert <tim.schubert@tu-bs.de> Date: Thu, 23 Aug 2018 13:04:28 +0200 Subject: [PATCH] Add updated documentation and tests --- check_deadlines.sh | 14 -------------- deadline.sh | 13 ------------- Makefile => doc/Makefile | 0 conf.py => doc/conf.py | 2 +- index.rst => doc/index.rst | 11 ++++++++++- make.bat => doc/make.bat | 0 notes.md => doc/notes.md | 0 setup.cfg | 2 ++ tests/.#test_students.py | 1 + tests/__init.py__ | 0 tests/test_auth.py | 8 ++++++++ tests/test_commands.py | 27 +++++++++++++++++++++++++++ tests/test_projects.py | 0 tests/test_students.py | 0 tox.ini | 14 ++++++++++++++ 15 files changed, 63 insertions(+), 29 deletions(-) delete mode 100755 check_deadlines.sh delete mode 100755 deadline.sh rename Makefile => doc/Makefile (100%) rename conf.py => doc/conf.py (99%) rename index.rst => doc/index.rst (71%) rename make.bat => doc/make.bat (100%) rename notes.md => doc/notes.md (100%) create mode 100644 setup.cfg create mode 120000 tests/.#test_students.py create mode 100644 tests/__init.py__ create mode 100644 tests/test_auth.py create mode 100644 tests/test_commands.py create mode 100644 tests/test_projects.py create mode 100644 tests/test_students.py create mode 100644 tox.ini diff --git a/check_deadlines.sh b/check_deadlines.sh deleted file mode 100755 index eb26aff..0000000 --- a/check_deadlines.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -for d in $(cat abgaben.txt) -do - time=$(echo $d | cut -d',' -f1) - tag=$(echo $d | cut -d',' -f2) - now=$(date --iso-8601) - - if [[ "$time" < "$now" ]] || [[ "$time" = "$now" ]] - then - git tag ${tag} - git push --tags - fi -done diff --git a/deadline.sh b/deadline.sh deleted file mode 100755 index 65d6ff1..0000000 --- a/deadline.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -set -eu - -read -p "Enter a name for the exercise (used for tag name): " exercise_name - -read -p "Are you sure you want to create a new tag? This will cause a new tag to be created in each student project and run JPlag on the solutions. [N/y]: " cont - -if [ ${cont} == 'y' ] || [ ${cont} == 'Y' ] -then - git tag "${exercise_name}" - git push --tag -fi diff --git a/Makefile b/doc/Makefile similarity index 100% rename from Makefile rename to doc/Makefile diff --git a/conf.py b/doc/conf.py similarity index 99% rename from conf.py rename to doc/conf.py index b606110..085ff35 100644 --- a/conf.py +++ b/doc/conf.py @@ -14,7 +14,7 @@ # import os import sys -sys.path.insert(0, os.path.abspath('.')) +sys.path.insert(0, os.path.abspath('../src')) # -- Project information ----------------------------------------------------- diff --git a/index.rst b/doc/index.rst similarity index 71% rename from index.rst rename to doc/index.rst index c81f3a1..8836464 100644 --- a/index.rst +++ b/doc/index.rst @@ -22,5 +22,14 @@ Indices and tables .. automodule:: abgabesystem :members: -.. autoclass:: abgabesystem.Student +.. automodule:: abgabesystem.projects + :members: + +.. automodule:: abgabesystem.students + :members: + +.. automodule:: abgabesystem.commands + :members: + +.. autoclass:: abgabesystem.students.Student :members: diff --git a/make.bat b/doc/make.bat similarity index 100% rename from make.bat rename to doc/make.bat diff --git a/notes.md b/doc/notes.md similarity index 100% rename from notes.md rename to doc/notes.md diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..9af7e6f --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[aliases] +test=pytest \ No newline at end of file diff --git a/tests/.#test_students.py b/tests/.#test_students.py new file mode 120000 index 0000000..466da6a --- /dev/null +++ b/tests/.#test_students.py @@ -0,0 +1 @@ +tim@metis.680:1534753335 \ No newline at end of file diff --git a/tests/__init.py__ b/tests/__init.py__ new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_auth.py b/tests/test_auth.py new file mode 100644 index 0000000..c5a7e97 --- /dev/null +++ b/tests/test_auth.py @@ -0,0 +1,8 @@ +import gitlab + + +def auth(config="/tmp/python-gitlab.cfg"): + gl = gitlab.Gitlab.from_config(config_files=[config]) + gl.auth() + + return gl diff --git a/tests/test_commands.py b/tests/test_commands.py new file mode 100644 index 0000000..3b90fcc --- /dev/null +++ b/tests/test_commands.py @@ -0,0 +1,27 @@ +import gitlab + +from abgabesystem.commands import create_users, projects, deadline, plagiates, course + + +gl = gitlab.Gitlab.from_config() +gl.auth() + + +def test_create_users(): + pass + + +def test_courses(): + pass + + +def test_projects(): + pass + + +def test_deadlines(): + pass + + +def test_plagiates(): + pass diff --git a/tests/test_projects.py b/tests/test_projects.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_students.py b/tests/test_students.py new file mode 100644 index 0000000..e69de29 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..274a981 --- /dev/null +++ b/tox.ini @@ -0,0 +1,14 @@ +# tox (https://tox.readthedocs.io/) is a tool for running tests +# in multiple virtualenvs. This configuration file will run the +# test suite on all supported python versions. To use it, "pip install tox" +# and then run "tox" from this directory. + +[tox] +envlist = py37 + +[testenv] +deps = + pytest + python-gitlab +commands = + pytest