Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.example.cmake
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
bob
bob.example.cmake
Commits
e97695e9
Commit
e97695e9
authored
9 years ago
by
Manuel Günther
Browse files
Options
Downloads
Patches
Plain Diff
Added nose test to test the package
parent
f90e6a2c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test.py
+33
-0
33 additions, 0 deletions
test.py
with
33 additions
and
0 deletions
test.py
0 → 100644
+
33
−
0
View file @
e97695e9
def
test_package
():
# This function tests that the example actually runs
# As the test requires that buildout already ran, we do not run buildout again
import
subprocess
import
os
,
shutil
import
tempfile
import
bob.extension
tmp
=
tempfile
.
mkdtemp
(
prefix
=
"
bobtest_
"
)
here
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
try
:
# find cmake executable
cmake
=
bob
.
extension
.
find_executable
(
"
cmake
"
)
assert
len
(
cmake
)
cmake
=
cmake
[
0
]
# run cmake in the temp directory
assert
subprocess
.
call
([
cmake
,
here
],
cwd
=
tmp
)
==
0
assert
subprocess
.
call
([
'
make
'
],
cwd
=
tmp
)
==
0
# run the test executable
assert
os
.
path
.
exists
(
os
.
path
.
join
(
tmp
,
"
my_test
"
))
shutil
.
copy
(
os
.
path
.
join
(
here
,
"
test.png
"
),
tmp
)
assert
subprocess
.
call
([
"
./my_test
"
],
cwd
=
tmp
)
==
0
# assert that the test outout file actually was created
assert
os
.
path
.
exists
(
os
.
path
.
join
(
tmp
,
"
test.hdf5
"
))
finally
:
shutil
.
rmtree
(
tmp
)
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