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
1b8b7aab
Commit
1b8b7aab
authored
Aug 05, 2020
by
Alexander Lercher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed integration test in role-stage-discovery
parent
6706e220
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
testing.py
bin/testing.py
+11
-2
test_similarity.py
...stage-discovery-microservice/app/tests/test_similarity.py
+1
-1
No files found.
bin/testing.py
View file @
1b8b7aab
...
@@ -3,6 +3,14 @@ import sys
...
@@ -3,6 +3,14 @@ import sys
import
importlib.util
import
importlib.util
import
pathlib
import
pathlib
'''
This script searches for all 'tests/' directories and executes all tests
by cd'ing into the dir and executing unittest discover.
It additionally installs all dependencies from a '../requirements.txt' via pip.
Use command line argument '-w' to run on windows.
'''
PY
=
'py'
if
(
len
(
sys
.
argv
)
>
1
and
sys
.
argv
[
1
]
==
'-w'
)
else
'python3.7'
# use -w to run on windows
ROOT
=
pathlib
.
Path
(
__file__
)
.
parent
.
parent
.
absolute
()
ROOT
=
pathlib
.
Path
(
__file__
)
.
parent
.
parent
.
absolute
()
TESTS_FOLDER_NAME
=
os
.
path
.
normpath
(
"/tests"
)
TESTS_FOLDER_NAME
=
os
.
path
.
normpath
(
"/tests"
)
...
@@ -14,14 +22,15 @@ for (dirname, dirs, files) in os.walk(ROOT):
...
@@ -14,14 +22,15 @@ for (dirname, dirs, files) in os.walk(ROOT):
#I assume all the tests are placed in a folder named "tests"
#I assume all the tests are placed in a folder named "tests"
if
(
TESTS_FOLDER_NAME
in
str
(
dirname
))
\
if
(
TESTS_FOLDER_NAME
in
str
(
dirname
))
\
and
'src'
in
str
(
dirname
)
\
and
not
(
f
"{TESTS_FOLDER_NAME}{os.path.normpath('/')}"
in
str
(
dirname
))
\
and
not
(
f
"{TESTS_FOLDER_NAME}{os.path.normpath('/')}"
in
str
(
dirname
))
\
and
not
(
"venv"
in
str
(
dirname
)):
and
not
(
"venv"
in
str
(
dirname
)):
try
:
try
:
print
(
f
"Executing tests in {dirname}"
)
print
(
f
"Executing tests in {dirname}"
)
os
.
chdir
(
os
.
path
.
normpath
(
dirname
))
os
.
chdir
(
os
.
path
.
normpath
(
dirname
))
# TODO do this during docker image setup
# TODO do this during docker image setup
exit_val
=
os
.
system
(
"python3.7
-m pip install -r ../requirements.txt"
)
# install pip dependencies
exit_val
=
os
.
system
(
f
"{PY}
-m pip install -r ../requirements.txt"
)
# install pip dependencies
exit_val
=
os
.
system
(
"python3.7
-m unittest discover"
)
# execute the tests
exit_val
=
os
.
system
(
f
"{PY}
-m unittest discover"
)
# execute the tests
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
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
:
except
Exception
as
e
:
print
(
e
)
print
(
e
)
...
...
src/data-hub/role-stage-discovery-microservice/app/tests/test_similarity.py
View file @
1b8b7aab
import
unittest
import
unittest
import
sys
import
sys
for
path
in
[
'../'
,
'./'
,
'../../../modules/'
]:
for
path
in
[
'../'
,
'./'
,
'../../../modules/'
,
'../../../../modules'
]:
sys
.
path
.
insert
(
1
,
path
)
sys
.
path
.
insert
(
1
,
path
)
from
db.entities.connected_node
import
NodeC
from
db.entities.connected_node
import
NodeC
...
...
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