Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WindEnergyToolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
toolbox
WindEnergyToolbox
Commits
07feda9f
There was a problem fetching the pipeline summary.
Commit
07feda9f
authored
9 years ago
by
Mads M. Pedersen
Browse files
Options
Downloads
Patches
Plain Diff
test
parent
0670ba69
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/testsuite.py
+63
-63
63 additions, 63 deletions
tests/testsuite.py
with
63 additions
and
63 deletions
tests/testsuite.py
+
63
−
63
View file @
07feda9f
import
glob
import
glob
import
unittest
import
unittest
import
os
import
os
def
module_strings
():
def
module_strings
():
test_file_paths
=
glob
.
glob
(
'
test_*.py
'
)
test_file_paths
=
glob
.
glob
(
'
test_*.py
'
)
#test_file_strings.extend(glob.glob('../wetb/**/test_*.py'))
#test_file_strings.extend(glob.glob('../wetb/**/test_*.py'))
#for root,_,_ in os.walk("../wetb/"):
#for root,_,_ in os.walk("../wetb/"):
for
folder
,
_
,
_
in
os
.
walk
(
'
../wetb
'
):
for
folder
,
_
,
_
in
os
.
walk
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'
../wetb
'
)
)
:
test_file_paths
.
extend
(
glob
.
glob
(
os
.
path
.
join
(
folder
,
"
tests/test_*.py
"
)))
test_file_paths
.
extend
(
glob
.
glob
(
os
.
path
.
join
(
folder
,
"
tests/test_*.py
"
)))
return
[
s
[
3
:
len
(
s
)
-
3
].
replace
(
os
.
path
.
sep
,
"
.
"
)
for
s
in
test_file_paths
]
return
[
s
[
3
:
len
(
s
)
-
3
].
replace
(
os
.
path
.
sep
,
"
.
"
)
for
s
in
test_file_paths
]
def
suite
():
def
suite
():
try
:
try
:
suites
=
[]
suites
=
[]
for
s
in
module_strings
():
for
s
in
module_strings
():
suites
.
append
(
unittest
.
defaultTestLoader
.
loadTestsFromName
(
s
))
suites
.
append
(
unittest
.
defaultTestLoader
.
loadTestsFromName
(
s
))
except
:
except
:
print
(
"
Failed to import
'
%s
'"
%
s
)
print
(
"
Failed to import
'
%s
'"
%
s
)
return
unittest
.
TestSuite
(
suites
)
return
unittest
.
TestSuite
(
suites
)
#no_tests = 0
#no_tests = 0
#all = set()
#all = set()
#all_modules = set()
#all_modules = set()
#for s in module_strings():
#for s in module_strings():
# if s.split('.')[-1] in all_modules:
# if s.split('.')[-1] in all_modules:
# print ("!!!!!%s already loaded" % s)
# print ("!!!!!%s already loaded" % s)
# all_modules.add(s.split('.')[-1])
# all_modules.add(s.split('.')[-1])
# m = __import__(s, {}, {}, "*")
# m = __import__(s, {}, {}, "*")
# cls = [t for t in m.__dict__.keys() if t.lower().startswith('test') and t != 'TestCaseAppFunc' and t != "TestCase" and t.strip()[0] != "#"]
# cls = [t for t in m.__dict__.keys() if t.lower().startswith('test') and t != 'TestCaseAppFunc' and t != "TestCase" and t.strip()[0] != "#"]
#
#
# test_funcs = [t for t in dir(m.__dict__[cls[0]]) if t.lower().startswith('test') and t != 'testfilepath']
# test_funcs = [t for t in dir(m.__dict__[cls[0]]) if t.lower().startswith('test') and t != 'testfilepath']
# for t in test_funcs:
# for t in test_funcs:
# if t in all:
# if t in all:
# print ("!!!!!!!!! %s already present" % t)
# print ("!!!!!!!!! %s already present" % t)
# pass
# pass
# else:
# else:
# all.add(t)
# all.add(t)
# no_tests += len(test_funcs)
# no_tests += len(test_funcs)
# print ("%-40s" % s, len(test_funcs), "\t\t", test_funcs)
# print ("%-40s" % s, len(test_funcs), "\t\t", test_funcs)
#print ("Number of tests: ", no_tests, len(all), len(module_strings()))
#print ("Number of tests: ", no_tests, len(all), len(module_strings()))
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
runner
=
unittest
.
TextTestRunner
()
runner
=
unittest
.
TextTestRunner
()
test_suite
=
suite
()
test_suite
=
suite
()
runner
.
run
(
test_suite
)
runner
.
run
(
test_suite
)
else
:
else
:
# for run as pydev unit-test
# for run as pydev unit-test
try
:
try
:
for
mstr
in
module_strings
():
for
mstr
in
module_strings
():
__import__
(
mstr
,
{},
{},
"
*
"
)
__import__
(
mstr
,
{},
{},
"
*
"
)
exec
(
"
from %s import *
"
%
mstr
)
exec
(
"
from %s import *
"
%
mstr
)
except
Exception
as
e
:
except
Exception
as
e
:
for
mstr
in
module_strings
():
for
mstr
in
module_strings
():
print
(
mstr
)
print
(
mstr
)
__import__
(
mstr
,
{},
{},
"
*
"
)
__import__
(
mstr
,
{},
{},
"
*
"
)
exec
(
"
from %s import *
"
%
mstr
)
exec
(
"
from %s import *
"
%
mstr
)
\ No newline at end of file
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