Package: projectnameTest
Test runsRun python tests locally in the build folderNot installed depencenciesInside the docker container of 2.9Linkthe dune modules are not installed,
sinceDUNECI_INSTALL_STAGEis not set to 1, seeLinkRunning the python tests of projectnameTest fails using the following commands. (To get this working i had to setset (CMAKE_PREFIX_PATH "/duneci/modules/dune-common/build-cmake")in the toplevel CMakeLists.txt)dockercontainerrun-it--entrypoint/bin/bashregistry.dune-project.org/docker/ci/dune:2.9
gitclonehttps://gitlab.dune-project.org/alexander.mueller/testpythonbindings.gitcdtestpythonbindings/
dunecontrol--only=projectnameTestallcdbuild-cmake
ctest--verbosetest1.pyandtest2.pyfails with:ValueError:KeyINSTALL_PREFIXisexpectedtobeuniqueacrossthegivenmetadata.Got{'/usr/local','/duneci/install'}Full test resultsduneci@e7fac7d916b9:~/testpythonbindings/build-cmake$ctest--verbose
UpdateCTestConfigurationfrom:/duneci/testpythonbindings/build-cmake/DartConfiguration.tcl
ParseConfigfile:/duneci/testpythonbindings/build-cmake/DartConfiguration.tcl
UpdateCTestConfigurationfrom:/duneci/testpythonbindings/build-cmake/DartConfiguration.tcl
ParseConfigfile:/duneci/testpythonbindings/build-cmake/DartConfiguration.tcl
Testproject/duneci/testpythonbindings/build-cmake
Constructingalistoftests
Doneconstructingalistoftests
Updatingtestlistforfixtures
Added0teststomeetfixturerequirements
Checkingtestdependencygraph...
Checkingtestdependencygraphendtest1Start1:pytest11:Testcommand:/duneci/testpythonbindings/build-cmake/run-in-dune-env"python""test1.py"1:Testtimeoutcomputedtobe:36001:Comparingbuilddirectoriesofinstalleddunemoduleswithgivenbuilddirectories1:DUNE-INFO:Generatingdune-pymodulein/duneci/modules/dune-common/build-cmake/dune-env/.cache/dune-py1:HelponpackageprojectnameTest:1:1:NAME1:projectnameTest1:1:DESCRIPTION1:# SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root1:# SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception1:1:PACKAGECONTENTS1:_projectnameTest1:1:FUNCTIONS1:add(...)methodofbuiltins.PyCapsuleinstance1:add(i:int,j:int)->int1:1:Afunctionwhichaddstwonumbers1:1:FILE1:/duneci/testpythonbindings/build-cmake/python/projectnameTest/__init__.py1:1:1:Traceback(mostrecentcalllast):1:File"/duneci/modules/dune-common/build-cmake/python/dune/common/__init__.py",line86,inFieldVector1:returnglobals()[fv](values)1:KeyError:'FieldVector_3'1:1:Duringhandlingoftheaboveexception,anotherexceptionoccurred:1:1:Traceback(mostrecentcalllast):1:File"/duneci/testpythonbindings/projectnameTest/python/test/test1.py",line17,in<module>1:v=FieldVector([0,1,2])1:File"/duneci/modules/dune-common/build-cmake/python/dune/common/__init__.py",line90,inFieldVector1:cls=_loadVec(includes,typeName).FieldVector1:File"/duneci/modules/dune-common/build-cmake/python/dune/common/__init__.py",line74,in_loadVec1:returngenerator.load(1:File"/duneci/modules/dune-common/build-cmake/python/dune/generator/generator.py",line172,inload1:returnself.post(moduleName,source,postscript,extraCMake)1:File"/duneci/modules/dune-common/build-cmake/python/dune/generator/generator.py",line124,inpost1:module=builder.load(moduleName,source,self.typeName[0],extraCMake)1:File"/duneci/modules/dune-common/build-cmake/python/dune/generator/cmakebuilder.py",line374,inload1:self.initialize()1:File"/duneci/modules/dune-common/build-cmake/python/dune/generator/cmakebuilder.py",line616,ininitialize1:super().initialize()1:File"/duneci/modules/dune-common/build-cmake/python/dune/generator/cmakebuilder.py",line213,ininitialize1:self.build_dunepy_from_template(self.dune_py_dir)1:File"/duneci/modules/dune-common/build-cmake/python/dune/generator/cmakebuilder.py",line448,inbuild_dunepy_from_template1:force=Builder.generate_dunepy_from_template(dunepy_dir,force=force)1:File"/duneci/modules/dune-common/build-cmake/python/dune/generator/cmakebuilder.py",line121,ingenerate_dunepy_from_template1:context["install_prefix"]=metaData.unique_value_across_modules("INSTALL_PREFIX")1:File"/duneci/modules/dune-common/build-cmake/python/dune/packagemetadata.py",line496,inunique_value_across_modules1:raiseValueError(f"Key {key} is expected to be unique across the given metadata. Got {values}")1:ValueError:KeyINSTALL_PREFIXisexpectedtobeuniqueacrossthegivenmetadata.Got{'/usr/local','/duneci/install'}1/2Test#1: pytest1 ..........................***Failed    0.59 sectest2Start2:pytest22:Testcommand:/duneci/testpythonbindings/build-cmake/run-in-dune-env"python""test2.py"2:Testtimeoutcomputedtobe:36002:Comparingbuilddirectoriesofinstalleddunemoduleswithgivenbuilddirectories2:DUNE-INFO:Generatingdune-pymodulein/duneci/modules/dune-common/build-cmake/dune-env/.cache/dune-py2:Traceback(mostrecentcalllast):2:File"/duneci/testpythonbindings/projectnameTest/python/test/test2.py",line20,in<module>2:grid=dune.grid.structuredGrid(lowerLeft,upperRight,elements)2:File"/duneci/modules/dune-grid/build-cmake/python/dune/grid/core.py",line13,instructuredGrid2:returnyaspGrid(domain,dimgrid=len(lower),coordinates="equidistantoffset")2:File"/duneci/modules/dune-grid/build-cmake/python/dune/grid/_grids.py",line253,inyaspGrid2:constructor=equidistantOffsetCoordinates(2:File"/duneci/modules/dune-grid/build-cmake/python/dune/grid/_grids.py",line165,inequidistantOffsetCoordinates2:mod=moduleYaspCoordinates(dim,ctype)2:File"/duneci/modules/dune-grid/build-cmake/python/dune/grid/_grids.py",line159,inmoduleYaspCoordinates2:module=builder.load(moduleName,source,"yasp coordinates dim={dim} ctype={ct}".format(ct=ctype,dim=dim))2:File"/duneci/modules/dune-common/build-cmake/python/dune/generator/cmakebuilder.py",line374,inload2:self.initialize()2:File"/duneci/modules/dune-common/build-cmake/python/dune/generator/cmakebuilder.py",line616,ininitialize2:super().initialize()2:File"/duneci/modules/dune-common/build-cmake/python/dune/generator/cmakebuilder.py",line213,ininitialize2:self.build_dunepy_from_template(self.dune_py_dir)2:File"/duneci/modules/dune-common/build-cmake/python/dune/generator/cmakebuilder.py",line448,inbuild_dunepy_from_template2:force=Builder.generate_dunepy_from_template(dunepy_dir,force=force)2:File"/duneci/modules/dune-common/build-cmake/python/dune/generator/cmakebuilder.py",line121,ingenerate_dunepy_from_template2:context["install_prefix"]=metaData.unique_value_across_modules("INSTALL_PREFIX")2:File"/duneci/modules/dune-common/build-cmake/python/dune/packagemetadata.py",line496,inunique_value_across_modules2:raiseValueError(f"Key {key} is expected to be unique across the given metadata. Got {values}")2:ValueError:KeyINSTALL_PREFIXisexpectedtobeuniqueacrossthegivenmetadata.Got{'/usr/local','/duneci/install'}2/2Test#2: pytest2 ..........................***Failed    0.60 sec0%testspassed,2testsfailedoutof2LabelTimeSummary:python=1.19sec*proc(2tests)quick=1.19sec*proc(2tests)TotalTesttime(real)=1.19sec

ThefollowingtestsFAILED:1-pytest1(Failed)2-pytest2(Failed)ErrorswhilerunningCTestInstalledWe use the same container but install the modules as similar? tohttps://gitlab.dune-project.org/docker/ci/-/blob/master/base-common/duneci-install-module#L118-L119.
(To get this working i had to setset (CMAKE_PREFIX_PATH "/duneci/install/lib/cmake/dune-common")in the toplevel CMakeLists.txt)
and removing the modules folder afterwards yields with the following commandsdockercontainerrun-it--entrypoint/bin/bashregistry.dune-project.org/docker/ci/dune:2.9cdmodules/
dunecontrol--only=dune-commonmakeinstallcd..
rm-rfmodules/
gitclonehttps://gitlab.dune-project.org/alexander.mueller/testpythonbindings.gitcdtestpythonbindings/
/duneci/install/bin/dunecontrol--only=projectnameTestallthe following errorERROR: The path "/duneci/modules" given in DUNE_CONTROL_PATH does not exist.
Execution of dunecontrol terminated due to errors!I suppose this is on purpose but why is the installation performed into the folder/duneci/install/binand not into/usr/binorusr/local/bin?
Somehow the installeddune-commonshould not depend on the downloaded build folder?
But my Linux knowledge is not good enough here, maybe.Test with homegrown MWE docker containerFor the container seeDockerImages/DockerFile**test1.pyandtest2.pyfails with:dockercontainerrun-it--entrypoint/bin/bashrath3t/dunepythonbindings:installedmodules
gitclonehttps://gitlab.dune-project.org/alexander.mueller/testpythonbindings.gitcdtestpythonbindings/
dunecontrol--only=projectnameTestallcdbuild-cmake
ctest--verbosebuilddir/usr/local/lib/cmake/dune-commonformoduledune-commonisexpectedtobeuniqueacrossthegivenmetadata-found/dune/dune-common/build-cmake2:Dunepythonpackagecouldnotbefound.Full test resultsroot@e4f98ef9aa1e:/testpythonbindings/build-cmake#ctest--verbose
UpdateCTestConfigurationfrom:/testpythonbindings/build-cmake/DartConfiguration.tcl
ParseConfigfile:/testpythonbindings/build-cmake/DartConfiguration.tcl
UpdateCTestConfigurationfrom:/testpythonbindings/build-cmake/DartConfiguration.tcl
ParseConfigfile:/testpythonbindings/build-cmake/DartConfiguration.tcl
Testproject/testpythonbindings/build-cmake
Constructingalistoftests
Doneconstructingalistoftests
Updatingtestlistforfixtures
Added0teststomeetfixturerequirements
Checkingtestdependencygraph...
Checkingtestdependencygraphendtest1Start1:pytest11:Testcommand:/testpythonbindings/build-cmake/run-in-dune-env"python""test1.py"1:Testtimeoutcomputedtobe:36001:Comparingbuilddirectoriesofinstalleddunemoduleswithgivenbuilddirectories1:builddir/usr/local/lib/cmake/dune-commonformoduledune-commonisexpectedtobeuniqueacrossthegivenmetadata-found/dune/dune-common/build-cmake1:Dunepythonpackagecouldnotbefound.1/2Test#1: pytest1 ..........................***Skipped   0.10 sectest2Start2:pytest22:Testcommand:/testpythonbindings/build-cmake/run-in-dune-env"python""test2.py"2:Testtimeoutcomputedtobe:36002:Comparingbuilddirectoriesofinstalleddunemoduleswithgivenbuilddirectories2:builddir/usr/local/lib/cmake/dune-commonformoduledune-commonisexpectedtobeuniqueacrossthegivenmetadata-found/dune/dune-common/build-cmake2:Dunepythonpackagecouldnotbefound.2/2Test#2: pytest2 ..........................***Skipped   0.10 sec100%testspassed,0testsfailedoutof2LabelTimeSummary:python=0.20sec*proc(2tests)quick=0.20sec*proc(2tests)TotalTesttime(real)=0.20sec

Thefollowingtestsdidnotrun:1-pytest1(Skipped)2-pytest2(Skipped)Not removing the dune folder where dune-common is downloaded (commentingRUN rm -rf dune/) inDockerImages/DockerFileyields the same error.It can be used via the docker imagerath3t/dunepythonbindings: installedmodulesNotDeletedBuildDir.QuestionsNot installed python testsIs this repository almost setup correctly in terms of python bindings? I got inspired bydumux, since I also want to have a module with its own namespace.Why does the above tests complain with a reference to/dune/dune-common/build-cmakeeven when the module is installed and this folder is removed?How to run the python tests correctly without installing the module projectnameTest?What needs to be present and how (installed dependencies) to circumvent the errors from above?Is there a magic combination of running these targets?build_tests projectnameTest _projectnameTest test_python build_python_testsI considermetadata_install_python_package_dune,install_python_package_dune,install_pythonas not needed for this question. Just from the naming they are use by installing the packageInstalling the local python module to run python tests with installed moduleHow should the module be installed:
Fromdune-project.org/dev/adding_pythonpip install -v --pre --log logfile --find-links file://$PWD/dist packagename==0.1or usingmetadata_install_python_package_dune,install_python_package_dune,install_pythonin some cobination.Can I then copy the test abovetest1.pyandtest2.pysomewhere and then can I test it withpython test1.pyor does this still happen inside the venv and I have to writerun-in-dune-env python test1.py? But where should the filerun-in-dune-envbe in this case, since all build directories are potentially deleted?git-9bb0efaad99002ec03a51327413983d742dd3821