diff --git a/bob/devtools/build.py b/bob/devtools/build.py index bf1ed405dd1d641cc1e6308ddc47f3bcd0ab1c76..6084c7ce79fe328a0b579aa9ab6b287852470c22 100644 --- a/bob/devtools/build.py +++ b/bob/devtools/build.py @@ -699,11 +699,12 @@ if __name__ == "__main__": "to enable debug messages [default: %(default)s]", ) parser.add_argument( - "--nose-eval-attr", + "--test-mark-expr", "-A", default="", help="Use this flag to avoid running certain tests during the build. " - "It forwards all settings to ``nosetests --eval-attr=<settings>``", + "It forwards all settings to ``nosetests`` via --eval-attr=<settings>``" + " and ``pytest`` via -m=<settings>.", ) args = parser.parse_args() @@ -723,7 +724,8 @@ if __name__ == "__main__": bootstrap.set_environment("DOCSERVER", server) bootstrap.set_environment("LANG", "en_US.UTF-8") bootstrap.set_environment("LC_ALL", os.environ["LANG"]) - bootstrap.set_environment("NOSE_EVAL_ATTR", args.nose_eval_attr) + bootstrap.set_environment("NOSE_EVAL_ATTR", args.test_mark_expr) + bootstrap.set_environment("PYTEST_ADDOPTS", f"-m '{args.test_mark_expr}'") # get information about the version of the package being built version, is_prerelease = check_version(args.work_dir, args.tag) diff --git a/bob/devtools/data/recipe_append.yaml b/bob/devtools/data/recipe_append.yaml index c0481152b266e4b8d412ba2750661527a880c518..f02e4e0b4b8705948e6b44528c579bfd1798cfa0 100644 --- a/bob/devtools/data/recipe_append.yaml +++ b/bob/devtools/data/recipe_append.yaml @@ -2,3 +2,4 @@ build: script_env: - DOCSERVER - NOSE_EVAL_ATTR + - PYTEST_ADDOPTS diff --git a/bob/devtools/scripts/alternative_nightlies.py b/bob/devtools/scripts/alternative_nightlies.py index 3726479b9a2f0c8b9ef098c54b498705dfa6b6fe..ad2179c454cd6b98c653b22d85be6df097825279 100644 --- a/bob/devtools/scripts/alternative_nightlies.py +++ b/bob/devtools/scripts/alternative_nightlies.py @@ -14,7 +14,7 @@ Examples: 2. Provide a list of key value pairs of arguments to be used as variables in the CI - $ bdt gitlab alt-nightlies -vv order.txt NOSE_EVAL_ATTR "not slow" + $ bdt gitlab alt-nightlies -vv order.txt TEST_MARK_EXPR "not slow" """ ) @click.argument( diff --git a/bob/devtools/scripts/build.py b/bob/devtools/scripts/build.py index d7fa57bd714e17cf852263a0d1df9b2b22994339..d94047063fb71145f9dd5cfecdbbf3feb1d61b16 100644 --- a/bob/devtools/scripts/build.py +++ b/bob/devtools/scripts/build.py @@ -138,11 +138,12 @@ Examples: ) @click.option( "-A", - "--nose-eval-attr", - envvar="NOSE_EVAL_ATTR", + "--test-mark-expr", + envvar="TEST_MARK_EXPR", default="", - help="Use this flag to avoid running certain tests during the build. " - "It forwards all settings to ``nosetests --eval-attr=<settings>``", + help="Use this flag to avoid running certain tests during the build. " + "It forwards all settings to ``nosetests`` via --eval-attr=<settings>``" + " and ``pytest`` via -m=<settings>.", ) @verbosity_option() @bdt.raise_on_error @@ -159,7 +160,7 @@ def build( stable, dry_run, ci, - nose_eval_attr, + test_mark_expr, ): """Builds package through conda-build with stock configuration. @@ -220,7 +221,9 @@ def build( set_environment("BOB_DOCUMENTATION_SERVER", doc_urls) # this is for testing and may limit which tests run - set_environment("NOSE_EVAL_ATTR", nose_eval_attr) + set_environment("NOSE_EVAL_ATTR", test_mark_expr) + set_environment("PYTEST_ADDOPTS", f"-m '{test_mark_expr}'") + arch = conda_arch() diff --git a/bob/devtools/scripts/ci.py b/bob/devtools/scripts/ci.py index 4dc3e8bcbb7c4ef8bbc01140a05e85e3eec38942..57773b3d6f152f87470e5a2a53bb6098c5ac04c2 100644 --- a/bob/devtools/scripts/ci.py +++ b/bob/devtools/scripts/ci.py @@ -482,7 +482,7 @@ def test(ctx, dry_run): stable="CI_COMMIT_TAG" in os.environ, dry_run=dry_run, ci=True, - nose_eval_attr=os.environ.get("NOSE_EVAL_ATTR", ""), + test_mark_expr=os.environ.get("TEST_MARK_EXPR", ""), ) @@ -558,7 +558,7 @@ def build(ctx, dry_run, recipe_dir): stable="CI_COMMIT_TAG" in os.environ, dry_run=dry_run, ci=True, - nose_eval_attr=os.environ.get("NOSE_EVAL_ATTR", ""), + test_mark_expr=os.environ.get("TEST_MARK_EXPR", ""), ) @@ -705,7 +705,7 @@ def nightlies(ctx, order, dry_run): stable=stable, dry_run=dry_run, ci=True, - nose_eval_attr=os.environ.get("NOSE_EVAL_ATTR", ""), + test_mark_expr=os.environ.get("TEST_MARK_EXPR", ""), ) is_master = os.environ["CI_COMMIT_REF_NAME"] == "master" diff --git a/bob/devtools/scripts/create.py b/bob/devtools/scripts/create.py index 61d3b6f18af9f7be16cad35f0577167fecfb6c01..bdd7c120118585897a438cf04e3d6d0d81e20648 100644 --- a/bob/devtools/scripts/create.py +++ b/bob/devtools/scripts/create.py @@ -229,6 +229,7 @@ def create( # set some environment variables before continuing set_environment("DOCSERVER", server, os.environ) set_environment("NOSE_EVAL_ATTR", "", os.environ) + set_environment("PYTEST_ADDOPTS", "", os.environ) logger.debug( 'This package is considered part of group "%s" - tunning ' diff --git a/bob/devtools/scripts/graph.py b/bob/devtools/scripts/graph.py index be4cddc0be747e95b9a43833c4caac8d94184b73..28d189c6a85836d747ebdd8a4b6fc349c6901b8d 100644 --- a/bob/devtools/scripts/graph.py +++ b/bob/devtools/scripts/graph.py @@ -201,6 +201,7 @@ def graph( # avoids conda-build complaints set_environment("NOSE_EVAL_ATTR", "") + set_environment("PYTEST_ADDOPTS", "") adj_matrix = compute_adjencence_matrix( gl, package, conda_config, upload_channel, deptypes=deptypes diff --git a/bob/devtools/scripts/rebuild.py b/bob/devtools/scripts/rebuild.py index 33e2c0d336eed17dbf0640ec285189ed57ded63b..1297a227bf9dac137398f119a0ca8654d6bbbbeb 100644 --- a/bob/devtools/scripts/rebuild.py +++ b/bob/devtools/scripts/rebuild.py @@ -126,11 +126,12 @@ Examples: ) @click.option( "-A", - "--nose-eval-attr", - envvar="NOSE_EVAL_ATTR", + "--test-mark-expr", + envvar="TEST_MARK_EXPR", default="", - help="Use this flag to avoid running certain tests during the build. " - "It forwards all settings to ``nosetests --eval-attr=<settings>``", + help="Use this flag to avoid running certain tests during the build. " + "It forwards all settings to ``nosetests`` via --eval-attr=<settings>``" + " and ``pytest`` via -m=<settings>.", ) @verbosity_option() @bdt.raise_on_error @@ -146,7 +147,7 @@ def rebuild( stable, dry_run, ci, - nose_eval_attr, + test_mark_expr, ): """Tests and rebuilds packages through conda-build with stock configuration. @@ -212,7 +213,8 @@ def rebuild( set_environment("BOB_DOCUMENTATION_SERVER", doc_urls) # this is for testing and may limit which tests run - set_environment("NOSE_EVAL_ATTR", nose_eval_attr) + set_environment("NOSE_EVAL_ATTR", test_mark_expr) + set_environment("PYTEST_ADDOPTS", f"-m '{test_mark_expr}'") arch = conda_arch() diff --git a/bob/devtools/scripts/test.py b/bob/devtools/scripts/test.py index f12042563ad53105a83ae18bed549e679f3a447b..6721d40e85035f48174ee3cd76335a1c02a401ae 100644 --- a/bob/devtools/scripts/test.py +++ b/bob/devtools/scripts/test.py @@ -117,11 +117,12 @@ Examples: ) @click.option( "-A", - "--nose-eval-attr", - envvar="NOSE_EVAL_ATTR", + "--test-mark-expr", + envvar="TEST_MARK_EXPR", default="", - help="Use this flag to avoid running certain tests during the build. " - "It forwards all settings to ``nosetests --eval-attr=<settings>``", + help="Use this flag to avoid running certain tests during the build. " + "It forwards all settings to ``nosetests`` via --eval-attr=<settings>``" + " and ``pytest`` via -m=<settings>.", ) @verbosity_option() @bdt.raise_on_error @@ -136,7 +137,7 @@ def test( stable, dry_run, ci, - nose_eval_attr, + test_mark_expr, ): """Tests (pre-built) package through conda-build with stock configuration. @@ -194,7 +195,8 @@ def test( set_environment("BOB_DOCUMENTATION_SERVER", doc_urls) # this is for testing and may limit which tests run - set_environment("NOSE_EVAL_ATTR", nose_eval_attr) + set_environment("NOSE_EVAL_ATTR", test_mark_expr) + set_environment("PYTEST_ADDOPTS", f"-m '{test_mark_expr}'") arch = conda_arch() for p in package: diff --git a/conda/recipe_append.yaml b/conda/recipe_append.yaml index c0481152b266e4b8d412ba2750661527a880c518..f02e4e0b4b8705948e6b44528c579bfd1798cfa0 100644 --- a/conda/recipe_append.yaml +++ b/conda/recipe_append.yaml @@ -2,3 +2,4 @@ build: script_env: - DOCSERVER - NOSE_EVAL_ATTR + - PYTEST_ADDOPTS