Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
hysop
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
Container Registry
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
Show more breadcrumbs
particle_methods
hysop
Commits
ec4ed45c
Commit
ec4ed45c
authored
12 years ago
by
Jean-Matthieu Etancelin
Browse files
Options
Downloads
Patches
Plain Diff
Fix python test discovering
parent
32e3fb52
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
HySoP/CMake/ParmesTests.cmake
+45
-7
45 additions, 7 deletions
HySoP/CMake/ParmesTests.cmake
with
45 additions
and
7 deletions
HySoP/CMake/ParmesTests.cmake
+
45
−
7
View file @
ec4ed45c
...
...
@@ -7,14 +7,11 @@ find_python_module(pytest REQUIRED)
set
(
py_src_dirs
fields
particular_solvers
domain
integrator
obstacle
operator
physics
problem
tools
numerics
)
if
(
USE_MPI
)
...
...
@@ -22,15 +19,57 @@ if(USE_MPI)
${
py_src_dirs
}
mpi
)
endif
()
### JM : Bub, GLOB_RECURSE utilse les chemins relatifs avec ../
# foreach(testdir ${py_src_dirs})
# file(GLOB_RECURSE py_test_files "${test_dir}" RELATIVE_PATH parmepy/*/test_*.py)
# endforeach()
## Build a list of test_*.py files recursively for each directory of parmepy/${py_src_dirs}
set
(
py_test_files
)
foreach
(
testdir
${
py_src_dirs
}
)
file
(
GLOB_RECURSE testfiles
RELATIVE
${
CMAKE_CURRENT_BINARY_DIR
}
${
CMAKE_SOURCE_DIR
}
/parmepy/
${
testdir
}
/test_*.py
)
set
(
py_test_files
${
py_test_files
}
${
testfiles
}
)
endforeach
()
## Handling doctest in *.py files recursively for each directory of parmepy/${py_src_dirs}
## that names are not __init__ or test_ and that contains '>>>'
set
(
py_doctest_files
)
foreach
(
testdir
${
py_src_dirs
}
)
file
(
GLOB_RECURSE py_test_files
"
${
test_dir
}
"
RELATIVE_PATH parmepy/*/test_*.py
)
file
(
GLOB_RECURSE testfiles
RELATIVE
${
CMAKE_CURRENT_BINARY_DIR
}
${
CMAKE_SOURCE_DIR
}
/parmepy/
${
testdir
}
/*.py
)
foreach
(
testfile
${
testfiles
}
)
if
(
NOT
${
testfile
}
MATCHES
"__init__|test_"
)
file
(
STRINGS
${
testfile
}
test_doctest
REGEX
">>>"
)
if
(
NOT
"
${
test_doctest
}
"
STREQUAL
""
)
set
(
py_doctest_files
${
py_doctest_files
}
${
testfile
}
)
endif
()
endif
()
endforeach
()
endforeach
()
## Adding tests
message
(
STATUS
"=== TESTS === "
)
## Add test_*.py files
foreach
(
testfile
${
py_test_files
}
)
get_filename_component
(
testName
${
testfile
}
NAME_WE
)
message
(
STATUS
"Add test
${
test
Nam
e
}
..."
)
message
(
STATUS
"Add test
${
test
fil
e
}
..."
)
add_test
(
${
testName
}
py.test -v
${
testfile
}
)
endforeach
()
## Add files containing doctests
foreach
(
testfile
${
py_doctest_files
}
)
get_filename_component
(
testName
${
testfile
}
NAME_WE
)
message
(
STATUS
"Add test from doc doctest_
${
testName
}
..."
)
add_test
(
"doctest_
${
testName
}
"
py.test -v
${
testfile
}
)
endforeach
()
message
(
STATUS
"==="
)
#add_test(NAME topology COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 4 py.test -v ${CMAKE_SOURCE_DIR}/parmepy/mpi/tests/test_topology.py)
# add_test(NAME topology COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 1 py.test -v ${CMAKE_SOURCE_DIR}/parmepy/mpi/tests/test_topology.py)
...
...
@@ -38,4 +77,3 @@ endforeach()
\ 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