Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UNI-KLU
SMART
Commits
3ab523bb
Commit
3ab523bb
authored
Feb 11, 2020
by
Bogdan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented testing script
parent
ad1ef89c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
1 deletion
+48
-1
testing.py
bin/testing.py
+45
-0
test_clusterer.py
...munity-detection-microservice/app/tests/test_clusterer.py
+1
-1
testabc.py
...hub/community-detection-microservice/app/tests/testabc.py
+2
-0
No files found.
bin/testing.py
0 → 100644
View file @
3ab523bb
import
os
import
sys
import
importlib.util
import
pathlib
ROOT
=
pathlib
.
Path
(
__file__
)
.
parent
.
parent
.
absolute
()
print
(
"
\n
Searching for tests at the path: "
+
str
(
ROOT
))
count
=
0
resultCodeList
=
[]
for
(
dirname
,
dirs
,
files
)
in
os
.
walk
(
ROOT
):
#print("\n In dir: "+ str(dirname))
#I assume all the tests are placed in a folder named "tests"
if
(
"
\\
tests"
in
str
(
dirname
))
and
not
(
"
\\
tests
\\
"
in
str
(
dirname
)):
try
:
os
.
chdir
(
os
.
path
.
normpath
(
dirname
))
exit_val
=
os
.
system
(
"py -m unittest discover"
)
resultCodeList
.
append
(
exit_val
)
#once per folder i.e if 3 tests are in a folder and crash, there will be just one exit val
except
Exception
as
e
:
print
(
e
)
continue
"""
for f in files:
#print("
\n
Get Current Directory "+ os.getcwd())
count += 1
print("
\n
"+ str(count) +" Executing: "+ str(os.path.normpath(dirname+"
\\
"+f)))
os.system("py "+ f)
"""
firstError
=
-
1
i
=
0
while
i
<
len
(
resultCodeList
):
if
resultCodeList
[
i
]
!=
0
:
print
(
"
\n
A test failed with code: "
+
resultCodeList
[
i
])
if
(
firstError
<
0
):
firstError
=
i
i
+=
1
if
(
firstError
<
0
):
#no errors found
sys
.
exit
(
0
)
else
:
sys
.
exit
(
resultCodeList
[
firstError
])
#return the error code of the first error
\ No newline at end of file
src/data-hub/community-detection-microservice/app/tests/test_clusterer.py
View file @
3ab523bb
import
unittest
import
unittest
import
sys
import
sys
sys
.
path
.
insert
(
1
,
'./'
)
sys
.
path
.
insert
(
1
,
'.
.
/'
)
# python -m unittest discover -v tests
# python -m unittest discover -v tests
from
processing.clusterer
import
Clusterer
from
processing.clusterer
import
Clusterer
...
...
src/data-hub/community-detection-microservice/app/tests/testabc.py
0 → 100644
View file @
3ab523bb
print
(
"In test ABC, hello wooorld"
)
#test = 4/0
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment