Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
Unitgrade
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tuhe
Unitgrade
Commits
6b8b30f2
Commit
6b8b30f2
authored
Jun 3, 2022
by
tuhe
Browse files
Options
Downloads
Patches
Plain Diff
updates
parent
228776fa
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
requirements.txt
+1
-4
1 addition, 4 deletions
requirements.txt
src/unitgrade/evaluate.py
+3
-1
3 additions, 1 deletion
src/unitgrade/evaluate.py
src/unitgrade/framework.py
+9
-9
9 additions, 9 deletions
src/unitgrade/framework.py
with
13 additions
and
14 deletions
requirements.txt
+
1
−
4
View file @
6b8b30f2
...
...
@@ -10,8 +10,5 @@ colorama
numpy
scikit_learn
snipper
<<<<<<< HEAD
importnb
#
Experimental
notebook
inclusion
feature.
May
not
be
required.
=======
requests
#
To
read
remote
files
for
automatic
updating.
>>>>>>> c157b3d262cc96db218ca37a4f96005cfec0d138
This diff is collapsed.
Click to expand it.
src/unitgrade/evaluate.py
+
3
−
1
View file @
6b8b30f2
...
...
@@ -172,7 +172,9 @@ def evaluate_report(report, question=None, qitem=None, passall=False, verbose=Fa
detail
[
'
status
'
]
=
'
error
'
else
:
raise
Exception
(
"
Status not known.
"
)
detail
=
{
**
detail
,
**
msg
}
#['message'] = msg
nice_title
=
s
.
title
detail
=
{
**
detail
,
**
msg
,
'
nice_title
'
:
nice_title
}
#['message'] = msg
details
[
key
]
=
detail
# q_[s._testMethodName] = ("pass", None)
...
...
This diff is collapsed.
Click to expand it.
src/unitgrade/framework.py
+
9
−
9
View file @
6b8b30f2
...
...
@@ -128,8 +128,8 @@ class Report:
if
not
url
.
endswith
(
"
/
"
):
url
+=
"
/
"
snapshot_file
=
os
.
path
.
dirname
(
self
.
_file
())
+
"
/unitgrade_data/.snapshot
"
print
(
"
Sanity checking time using snapshot
"
,
snapshot_file
)
print
(
"
and using self-identified file
"
,
self
.
_file
())
#
print("Sanity checking time using snapshot", snapshot_file)
#
print("and using self-identified file", self._file())
if
os
.
path
.
isfile
(
snapshot_file
):
with
open
(
snapshot_file
,
'
r
'
)
as
f
:
...
...
@@ -140,15 +140,15 @@ class Report:
if
self
.
url
.
startswith
(
"
https://gitlab
"
):
# Try to turn url into a 'raw' format.
"
https://gitlab.compute.dtu.dk/tuhe/unitgrade_private/-/raw/master/examples/autolab_example_py_upload/instructor/cs102_autolab/report2_test.py?inline=false
"
#
"https://gitlab.compute.dtu.dk/tuhe/unitgrade_private/-/raw/master/examples/autolab_example_py_upload/instructor/cs102_autolab/report2_test.py?inline=false"
# url = self.url
url
=
url
.
replace
(
"
-/tree
"
,
"
-/raw
"
)
print
(
url
)
#
print(url)
# "https://gitlab.compute.dtu.dk/tuhe/unitgrade_private/-/tree/master/examples/autolab_example_py_upload/instructor/cs102_autolab"
# "https://gitlab.compute.dtu.dk/tuhe/unitgrade_private/-/raw/master/examples/autolab_example_py_upload/instructor/report2_test.py?inline=false"
# "https://gitlab.compute.dtu.dk/tuhe/unitgrade_private/-/raw/master/examples/autolab_example_py_upload/instructor/cs102_autolab/report2_test.py?inline=false"
raw_url
=
urllib
.
parse
.
urljoin
(
url
,
os
.
path
.
basename
(
self
.
_file
())
+
"
?inline=false
"
)
print
(
"
Is this file run in local mode?
"
,
self
.
_is_run_in_grade_mode
())
#
print("Is this file run in local mode?", self._is_run_in_grade_mode())
if
self
.
_is_run_in_grade_mode
():
remote_source
=
requests
.
get
(
raw_url
).
text
with
open
(
self
.
_file
(),
'
r
'
)
as
f
:
...
...
@@ -430,12 +430,12 @@ class UTestCase(unittest.TestCase):
# file = inspect.getfile(self.__class__)
import
importlib
,
inspect
found_reports
=
[]
print
(
"
But do I have report
"
,
self
.
_report
)
print
(
"
I think I am module
"
,
self
.
__module__
)
print
(
"
Importlib says
"
,
importlib
.
import_module
(
self
.
__module__
))
#
print("But do I have report", self._report)
#
print("I think I am module", self.__module__)
#
print("Importlib says", importlib.import_module(self.__module__))
# This will delegate you to the wrong main clsas when running in grade mode.
for
name
,
cls
in
inspect
.
getmembers
(
importlib
.
import_module
(
self
.
__module__
),
inspect
.
isclass
):
print
(
"
checking
"
,
cls
)
#
print("checking", cls)
if
issubclass
(
cls
,
Report
):
for
q
,
_
in
cls
.
questions
:
if
q
==
self
.
__class__
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment