Skip to content
Snippets Groups Projects
Commit 126e52be authored by tuhe's avatar tuhe
Browse files

Removed pupdb dependency

parent 2a60682b
No related branches found
No related tags found
No related merge requests found
Showing
with 412 additions and 81 deletions
File added
File added
File added
This diff is collapsed.
File added
No preview for this file type
import os
from cs108.report_devel import Report2, mk_ok
from unitgrade_private.hidden_create_files import setup_grade_file_report
from snipper.snip_dir import snip_dir
def run_program():
import unittest
# import importlib.util
import sys
sys.path.append(os.path.normpath(os.getcwd() + "/../"))
# os.getcwd()
# spec = importlib.util.spec_from_file_location("cs108.report_devel", "/path/to/file.py")
# foo = importlib.util.module_from_spec(spec)
test = unittest.main(module='cs108.report_devel', exit=False, argv=('', "Numpy.test_bad",))
# from unittest import loader
# testloader = loader.TestLoader()
# import cs108.report_devel as m
#
# module = m
#
# tests = testloader.loadTestsFromNames(["Numpy.test_good"], module)
#
# a = 234
# self.test = self.testLoader.loadTestsFromNames(self.testNames,
# self.module)
pass
def main(with_coverage=True):
mk_ok()
setup_grade_file_report(Report2, with_coverage=with_coverage, minify=False, obfuscate=False,bzip=False)
# import cs108
# from cs108 import report_devel
if __name__ == "__main__":
# import pickle
# with open("unitgrade_data/Week1.pkl", 'rb') as f:
# rs = pickle.load(f)
# from diskcache import Cache
# c = Cache(directory="./unitgrade_data")
# c.set("index", "value")
# Du kan gemme det som en .json fil...
# from importlib import reload
# import cs108
# import sys
#
# r = Report2()
# q = r.questions[0][0]()
# for k,v in rs.items():
# print(k, v)
# from unitgrade_private import load_token
# data, txt = load_token("Report2_handin_38_of_38.token")
# print(data['details'][1]['items'] )
# None of that coverage shit.
# sys.modules.clear()
#
# # reload(cs108)
# cs108 = reload(cs108)
# # from cs108 import homework1
# # reload(homework1)
# del sys.modules['cs108']
# from cs108.homework1 import a
# print(a)
# reload(report_devel)
# a = 234
main(with_coverage=True)
snip_dir("./", "../../students/cs108", clean_destination_dir=True, exclude=['*.token', 'deploy.py'])
main(with_coverage=False)
import numpy as np
a = 245
def reverse_list(mylist): #!f
"""
Given a list 'mylist' returns a list consisting of the same elements in reverse order. E.g.
......
......@@ -2,6 +2,7 @@ from unitgrade.framework import Report
from unitgrade.evaluate import evaluate_report_student
from cs108.homework1 import add, reverse_list, linear_regression_weights, linear_predict, foo
from unitgrade import UTestCase, cache
from unitgrade.framework import classmethod_dashboard
import time
import numpy as np
import pickle
......@@ -18,28 +19,18 @@ def mk_ok():
d = {'x1': 1, 'x2': 2}
pickle.dump(d, f)
def formatHeader(fn):
from functools import wraps
@wraps(fn)
def wrapper(*args, **kw):
return fn(*args, **kw)
return wrapper
class Numpy(UTestCase):
z = 234
def __getattr__(self, item):
print("hi there ", item)
return super().__getattr__(item)
def __getattribute__(self, item):
print("oh hello sexy. ", item)
return super().__getattribute__(item)
# def __getattr__(self, item):
# print("hi there ", item)
# return super().__getattr__(item)
#
# def __getattribute__(self, item):
# print("oh hello sexy. ", item)
# return super().__getattribute__(item)
@classmethod
# @dash
@classmethod_dashboard
def setUpClass(cls) -> None:
print("Dum di dai, I am running some setup code here.")
for i in range(10):
......@@ -47,9 +38,12 @@ class Numpy(UTestCase):
print("Set up.") # must be handled seperately.
# assert False
@cache
def make_primes(self, n):
return primes(n)
# @cache
# def make_primes(self, n):
# return primes(n)
# def setUp(self) -> None:
# print("We are doing the setup thing.")
def test_bad(self):
"""
......@@ -98,17 +92,23 @@ class Numpy(UTestCase):
return "THE RESULT OF THE TEST"
class AnotherTest(UTestCase):
def test_more(self):
self.assertEqual(2,2)
def test_even_more(self):
self.assertEqual(2,2)
import cs108
class Report2(Report):
title = "CS 101 Report 2"
questions = [
(Numpy, 10),
(Numpy, 10), (AnotherTest, 20)
]
pack_imports = [cs108]
if __name__ == "__main__":
# import texttestrunner
import unittest
unittest.main()
# evaluate_report_student(Report2())
# import unittest
# unittest.main()
evaluate_report_student(Report2())
{"state": "pass", "run_id": 863304, "coverage_files_changed": null, "stdout": [[0, "Dashboard> Evaluation completed."]]}
\ No newline at end of file
{"state": "pass", "run_id": 282722, "coverage_files_changed": null, "stdout": [[0, "Dashboard> Evaluation completed."]]}
\ No newline at end of file
File added
{"run_id": 188727, "coverage_files_changed": null, "stdout": [[0, "Dum di dai, I am running some setup code here.\nHello world 0\nHello world 1\nHello world 2\nHello world 3\nHello world 4\nHello world 5\nHello world 6\nHello world 7\nHello world 8\nHello world 9\nSet up.\nDashboard> Evaluation completed."]], "state": "pass"}
\ No newline at end of file
{"coverage_files_changed": null, "run_id": 613968, "state": "pass", "stdout": [[0, "oh hello sexy. _testMethodName\noh hello sexy. test_weights\noh hello sexy. __class__\noh hello sexy. __unittest_expecting_failure__\nhi there __unittest_expecting_failure__\noh hello sexy. _callSetUp\noh hello sexy. _with_coverage\noh hello sexy. setUp\noh hello sexy. _callTestMethod\noh hello sexy. _ensure_cache_exists\noh hello sexy. __class__\noh hello sexy. __class__\noh hello sexy. __class__\noh hello sexy. __class__\noh hello sexy. _testMethodDoc\noh hello sexy. _cache_put\noh hello sexy. cache_id\noh hello sexy. __class__\noh hello sexy. _testMethodName\noh hello sexy. shortDescriptionStandard\noh hello sexy. _testMethodDoc\noh hello sexy. _testMethodName\noh hello sexy. _ensure_cache_exists\noh hello sexy. __class__\noh hello sexy. __class__\noh hello sexy. __class__\noh hello sexy. __class__\noh hello sexy. __class__\noh hello sexy. _cache2\noh hello sexy. cache_id\noh hello sexy. __class__\noh hello sexy. _testMethodName\noh hello sexy. assertEqual\noh hello sexy. _getAssertEqualityFunc\noh hello sexy. _type_equality_funcs\noh hello sexy. _baseAssertEqual\noh hello sexy. _get_outcome\noh hello sexy. __class__\noh hello sexy. __class__\noh hello sexy. __class__\noh hello sexy. __class__\noh hello sexy. cache_id\noh hello sexy. __class__\noh hello sexy. _testMethodName\noh hello sexy. _cache_put\noh hello sexy. cache_id\noh hello sexy. __class__\noh hello sexy. _testMethodName\noh hello sexy. _ensure_cache_exists\noh hello sexy. __class__\noh hello sexy. __class__\noh hello sexy. __class__\noh hello sexy. __class__\noh hello sexy. __class__\noh hello sexy. _callTearDown\noh hello sexy. tearDown\noh hello sexy. _with_coverage\noh hello sexy. doCleanups\noh hello sexy. _outcome\noh hello sexy. _cleanups\noh hello sexy. _feedErrorsToResult\noh hello sexy. __class__\noh hello sexy. __class__\noh hello sexy. __class__\noh hello sexy. _error_fed_during_run\n"]]}
\ No newline at end of file
{"state": "pass", "run_id": 766225, "coverage_files_changed": null, "stdout": [[0, "Dashboard> Evaluation completed."]]}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment