Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
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
Core Modules
dune-common
Commits
e906f757
Commit
e906f757
authored
4 years ago
by
Andreas Dedner
Browse files
Options
Downloads
Patches
Plain Diff
use 'SCRIPT' as parameter instead of 'COMMAND' since we are now passing
a python script to 'dune_python_add_test'
parent
e18d6f5f
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!914
add Python3_EXECUTABLE to `dune_python_add_test`
Pipeline
#32619
passed with warnings
4 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cmake/modules/DunePythonTestCommand.cmake
+10
-13
10 additions, 13 deletions
cmake/modules/DunePythonTestCommand.cmake
dune/python/test/CMakeLists.txt
+1
-1
1 addition, 1 deletion
dune/python/test/CMakeLists.txt
with
11 additions
and
14 deletions
cmake/modules/DunePythonTestCommand.cmake
+
10
−
13
View file @
e906f757
...
...
@@ -2,20 +2,17 @@
#
# .. cmake_function:: dune_python_add_test
#
# .. cmake_param::
COMMAND
# .. cmake_param::
SCRIPT
# :multi:
# :required:
#
# The
command to run
. It will be executed during :code:`make test_python`
# The
script to execute using the python interpreter
. It will be executed during :code:`make test_python`
# and during `ctest`.
#
# .. note::
#
# If your testing command involves an invocation of the python
# interpreter you should use :code:`${Python3_EXECUTABLE}` for that.
# Also calling python executables through :code:`-m` is generally to
# be favored, e.g. :code:`${Python3_EXECUTABLE} -m pytest` instead of
# :code:`py.test`.
# The script will be executed using
# :code:`${Python3_EXECUTABLE} SCRIPT`.
#
# .. cmake_param:: WORKING_DIRECTORY
# :single:
...
...
@@ -40,7 +37,7 @@ function(dune_python_add_test)
include
(
CMakeParseArguments
)
set
(
OPTION
)
set
(
SINGLE WORKING_DIRECTORY NAME
)
set
(
MULTI
COMMAND
LABELS
)
set
(
MULTI
SCRIPT
LABELS
)
cmake_parse_arguments
(
PYTEST
"
${
OPTION
}
"
"
${
SINGLE
}
"
"
${
MULTI
}
"
${
ARGN
}
)
if
(
PYTEST_UNPARSED_ARGUMENTS
)
message
(
WARNING
"Unparsed arguments in dune_python_add_test: This often indicates typos!"
)
...
...
@@ -50,12 +47,12 @@ function(dune_python_add_test)
if
(
NOT PYTEST_WORKING_DIRECTORY
)
set
(
PYTEST_WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
)
endif
()
if
(
NOT PYTEST_
COMMAND
)
message
(
FATAL_ERROR
"dune_python_add_test: no
COMMAND
to execute specified!"
)
if
(
NOT PYTEST_
SCRIPT
)
message
(
FATAL_ERROR
"dune_python_add_test: no
SCRIPT
to execute specified!"
)
endif
()
if
(
NOT PYTEST_NAME
)
set
(
commandstr
""
)
foreach
(
comm
${
PYTEST_
COMMAND
}
)
foreach
(
comm
${
PYTEST_
SCRIPT
}
)
set
(
commandstr
"
${
commandstr
}
_
${
comm
}
"
)
endforeach
()
set
(
commandstr
"
${
commandstr
}
_
${
PYTEST_WORKING_DIRECTORY
}
"
)
...
...
@@ -64,7 +61,7 @@ function(dune_python_add_test)
# Actually run the command
add_custom_target
(
target_
${
PYTEST_NAME
}
COMMAND
${
Python3_EXECUTABLE
}
${
PYTEST_
COMMAND
}
COMMAND
${
Python3_EXECUTABLE
}
${
PYTEST_
SCRIPT
}
WORKING_DIRECTORY
${
PYTEST_WORKING_DIRECTORY
}
)
# Build this during make test_python
...
...
@@ -74,7 +71,7 @@ function(dune_python_add_test)
dune_declare_test_label
(
LABELS
${
PYTEST_LABELS
}
)
# Also build this during ctest
_add_test
(
NAME
${
PYTEST_NAME
}
COMMAND
${
Python3_EXECUTABLE
}
${
PYTEST_
COMMAND
}
COMMAND
${
Python3_EXECUTABLE
}
${
PYTEST_
SCRIPT
}
WORKING_DIRECTORY
${
PYTEST_WORKING_DIRECTORY
}
)
# Set the labels on the test
...
...
This diff is collapsed.
Click to expand it.
dune/python/test/CMakeLists.txt
+
1
−
1
View file @
e906f757
dune_python_add_test
(
NAME pythontests
COMMAND
pythontests.py
SCRIPT
pythontests.py
WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
LABELS quick
)
...
...
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