From 737675cd5a60b91081155a6dc2a58dbace5c1bd2 Mon Sep 17 00:00:00 2001 From: Paul Madden <136389411+maddenp-noaa@users.noreply.github.com> Date: Wed, 5 Jun 2024 10:45:37 -0600 Subject: [PATCH] Test Concurrency (#504) --- .../cli/tools/file/copy-exec-timedep.out | 20 ++++++------- .../user_guide/cli/tools/file/copy-exec.out | 30 +++++++++---------- .../cli/tools/file/link-exec-timedep.out | 20 ++++++------- .../user_guide/cli/tools/file/link-exec.out | 30 +++++++++---------- recipe/meta.json | 21 ++++++------- recipe/meta.yaml | 15 +++++----- recipe/run_test.sh | 5 ++-- src/uwtools/tests/support.py | 11 ------- src/uwtools/tests/utils/test_file.py | 6 ++-- 9 files changed, 75 insertions(+), 83 deletions(-) diff --git a/docs/sections/user_guide/cli/tools/file/copy-exec-timedep.out b/docs/sections/user_guide/cli/tools/file/copy-exec-timedep.out index ac48b86db..56be1a29f 100644 --- a/docs/sections/user_guide/cli/tools/file/copy-exec-timedep.out +++ b/docs/sections/user_guide/cli/tools/file/copy-exec-timedep.out @@ -1,13 +1,13 @@ -[2024-05-29T16:50:14] INFO Validating config against internal schema files-to-stage -[2024-05-29T16:50:14] INFO 0 UW schema-validation errors found -[2024-05-29T16:50:14] INFO File copies: Initial state: Pending -[2024-05-29T16:50:14] INFO File copies: Checking requirements -[2024-05-29T16:50:14] INFO Copy src/20240529/12/006/baz -> copy-dst-timedep/baz-2024-05-29T18: Initial state: Pending -[2024-05-29T16:50:14] INFO Copy src/20240529/12/006/baz -> copy-dst-timedep/baz-2024-05-29T18: Checking requirements -[2024-05-29T16:50:14] INFO Copy src/20240529/12/006/baz -> copy-dst-timedep/baz-2024-05-29T18: Requirement(s) ready -[2024-05-29T16:50:14] INFO Copy src/20240529/12/006/baz -> copy-dst-timedep/baz-2024-05-29T18: Executing -[2024-05-29T16:50:14] INFO Copy src/20240529/12/006/baz -> copy-dst-timedep/baz-2024-05-29T18: Final state: Ready -[2024-05-29T16:50:14] INFO File copies: Final state: Ready +[2024-06-05T15:24:49] INFO Validating config against internal schema files-to-stage +[2024-06-05T15:24:49] INFO 0 UW schema-validation errors found +[2024-06-05T15:24:49] INFO File copies: Initial state: Not Ready +[2024-06-05T15:24:49] INFO File copies: Checking requirements +[2024-06-05T15:24:49] INFO Copy src/20240529/12/006/baz -> copy-dst-timedep/baz-2024-05-29T18: Initial state: Not Ready +[2024-06-05T15:24:49] INFO Copy src/20240529/12/006/baz -> copy-dst-timedep/baz-2024-05-29T18: Checking requirements +[2024-06-05T15:24:49] INFO Copy src/20240529/12/006/baz -> copy-dst-timedep/baz-2024-05-29T18: Requirement(s) ready +[2024-06-05T15:24:49] INFO Copy src/20240529/12/006/baz -> copy-dst-timedep/baz-2024-05-29T18: Executing +[2024-06-05T15:24:49] INFO Copy src/20240529/12/006/baz -> copy-dst-timedep/baz-2024-05-29T18: Final state: Ready +[2024-06-05T15:24:49] INFO File copies: Final state: Ready copy-dst-timedep └── baz-2024-05-29T18 diff --git a/docs/sections/user_guide/cli/tools/file/copy-exec.out b/docs/sections/user_guide/cli/tools/file/copy-exec.out index 52d30e23f..2c9c63ff0 100644 --- a/docs/sections/user_guide/cli/tools/file/copy-exec.out +++ b/docs/sections/user_guide/cli/tools/file/copy-exec.out @@ -1,18 +1,18 @@ -[2024-05-29T16:50:14] INFO Validating config against internal schema files-to-stage -[2024-05-29T16:50:14] INFO 0 UW schema-validation errors found -[2024-05-29T16:50:14] INFO File copies: Initial state: Pending -[2024-05-29T16:50:14] INFO File copies: Checking requirements -[2024-05-29T16:50:14] INFO Copy src/foo -> copy-dst/foo: Initial state: Pending -[2024-05-29T16:50:14] INFO Copy src/foo -> copy-dst/foo: Checking requirements -[2024-05-29T16:50:14] INFO Copy src/foo -> copy-dst/foo: Requirement(s) ready -[2024-05-29T16:50:14] INFO Copy src/foo -> copy-dst/foo: Executing -[2024-05-29T16:50:14] INFO Copy src/foo -> copy-dst/foo: Final state: Ready -[2024-05-29T16:50:14] INFO Copy src/bar -> copy-dst/subdir/bar: Initial state: Pending -[2024-05-29T16:50:14] INFO Copy src/bar -> copy-dst/subdir/bar: Checking requirements -[2024-05-29T16:50:14] INFO Copy src/bar -> copy-dst/subdir/bar: Requirement(s) ready -[2024-05-29T16:50:14] INFO Copy src/bar -> copy-dst/subdir/bar: Executing -[2024-05-29T16:50:14] INFO Copy src/bar -> copy-dst/subdir/bar: Final state: Ready -[2024-05-29T16:50:14] INFO File copies: Final state: Ready +[2024-06-05T15:24:50] INFO Validating config against internal schema files-to-stage +[2024-06-05T15:24:50] INFO 0 UW schema-validation errors found +[2024-06-05T15:24:50] INFO File copies: Initial state: Not Ready +[2024-06-05T15:24:50] INFO File copies: Checking requirements +[2024-06-05T15:24:50] INFO Copy src/foo -> copy-dst/foo: Initial state: Not Ready +[2024-06-05T15:24:50] INFO Copy src/foo -> copy-dst/foo: Checking requirements +[2024-06-05T15:24:50] INFO Copy src/foo -> copy-dst/foo: Requirement(s) ready +[2024-06-05T15:24:50] INFO Copy src/foo -> copy-dst/foo: Executing +[2024-06-05T15:24:50] INFO Copy src/foo -> copy-dst/foo: Final state: Ready +[2024-06-05T15:24:50] INFO Copy src/bar -> copy-dst/subdir/bar: Initial state: Not Ready +[2024-06-05T15:24:50] INFO Copy src/bar -> copy-dst/subdir/bar: Checking requirements +[2024-06-05T15:24:50] INFO Copy src/bar -> copy-dst/subdir/bar: Requirement(s) ready +[2024-06-05T15:24:50] INFO Copy src/bar -> copy-dst/subdir/bar: Executing +[2024-06-05T15:24:50] INFO Copy src/bar -> copy-dst/subdir/bar: Final state: Ready +[2024-06-05T15:24:50] INFO File copies: Final state: Ready copy-dst ├── foo diff --git a/docs/sections/user_guide/cli/tools/file/link-exec-timedep.out b/docs/sections/user_guide/cli/tools/file/link-exec-timedep.out index 3921e25cf..b0f76f803 100644 --- a/docs/sections/user_guide/cli/tools/file/link-exec-timedep.out +++ b/docs/sections/user_guide/cli/tools/file/link-exec-timedep.out @@ -1,13 +1,13 @@ -[2024-05-29T16:50:14] INFO Validating config against internal schema files-to-stage -[2024-05-29T16:50:14] INFO 0 UW schema-validation errors found -[2024-05-29T16:50:14] INFO File links: Initial state: Pending -[2024-05-29T16:50:14] INFO File links: Checking requirements -[2024-05-29T16:50:14] INFO Link link-dst-timedep/baz-2024-05-29T18 -> src/20240529/12/006/baz: Initial state: Pending -[2024-05-29T16:50:14] INFO Link link-dst-timedep/baz-2024-05-29T18 -> src/20240529/12/006/baz: Checking requirements -[2024-05-29T16:50:14] INFO Link link-dst-timedep/baz-2024-05-29T18 -> src/20240529/12/006/baz: Requirement(s) ready -[2024-05-29T16:50:14] INFO Link link-dst-timedep/baz-2024-05-29T18 -> src/20240529/12/006/baz: Executing -[2024-05-29T16:50:14] INFO Link link-dst-timedep/baz-2024-05-29T18 -> src/20240529/12/006/baz: Final state: Ready -[2024-05-29T16:50:14] INFO File links: Final state: Ready +[2024-06-05T15:24:50] INFO Validating config against internal schema files-to-stage +[2024-06-05T15:24:50] INFO 0 UW schema-validation errors found +[2024-06-05T15:24:50] INFO File links: Initial state: Not Ready +[2024-06-05T15:24:50] INFO File links: Checking requirements +[2024-06-05T15:24:50] INFO Link link-dst-timedep/baz-2024-05-29T18 -> src/20240529/12/006/baz: Initial state: Not Ready +[2024-06-05T15:24:50] INFO Link link-dst-timedep/baz-2024-05-29T18 -> src/20240529/12/006/baz: Checking requirements +[2024-06-05T15:24:50] INFO Link link-dst-timedep/baz-2024-05-29T18 -> src/20240529/12/006/baz: Requirement(s) ready +[2024-06-05T15:24:50] INFO Link link-dst-timedep/baz-2024-05-29T18 -> src/20240529/12/006/baz: Executing +[2024-06-05T15:24:50] INFO Link link-dst-timedep/baz-2024-05-29T18 -> src/20240529/12/006/baz: Final state: Ready +[2024-06-05T15:24:50] INFO File links: Final state: Ready link-dst-timedep └── baz-2024-05-29T18 -> ../src/20240529/12/006/baz diff --git a/docs/sections/user_guide/cli/tools/file/link-exec.out b/docs/sections/user_guide/cli/tools/file/link-exec.out index df662e10b..8a056aef4 100644 --- a/docs/sections/user_guide/cli/tools/file/link-exec.out +++ b/docs/sections/user_guide/cli/tools/file/link-exec.out @@ -1,18 +1,18 @@ -[2024-05-29T16:50:14] INFO Validating config against internal schema files-to-stage -[2024-05-29T16:50:14] INFO 0 UW schema-validation errors found -[2024-05-29T16:50:14] INFO File links: Initial state: Pending -[2024-05-29T16:50:14] INFO File links: Checking requirements -[2024-05-29T16:50:14] INFO Link link-dst/foo -> src/foo: Initial state: Pending -[2024-05-29T16:50:14] INFO Link link-dst/foo -> src/foo: Checking requirements -[2024-05-29T16:50:14] INFO Link link-dst/foo -> src/foo: Requirement(s) ready -[2024-05-29T16:50:14] INFO Link link-dst/foo -> src/foo: Executing -[2024-05-29T16:50:14] INFO Link link-dst/foo -> src/foo: Final state: Ready -[2024-05-29T16:50:14] INFO Link link-dst/subdir/bar -> src/bar: Initial state: Pending -[2024-05-29T16:50:14] INFO Link link-dst/subdir/bar -> src/bar: Checking requirements -[2024-05-29T16:50:14] INFO Link link-dst/subdir/bar -> src/bar: Requirement(s) ready -[2024-05-29T16:50:14] INFO Link link-dst/subdir/bar -> src/bar: Executing -[2024-05-29T16:50:14] INFO Link link-dst/subdir/bar -> src/bar: Final state: Ready -[2024-05-29T16:50:14] INFO File links: Final state: Ready +[2024-06-05T15:24:49] INFO Validating config against internal schema files-to-stage +[2024-06-05T15:24:49] INFO 0 UW schema-validation errors found +[2024-06-05T15:24:49] INFO File links: Initial state: Not Ready +[2024-06-05T15:24:49] INFO File links: Checking requirements +[2024-06-05T15:24:49] INFO Link link-dst/foo -> src/foo: Initial state: Not Ready +[2024-06-05T15:24:49] INFO Link link-dst/foo -> src/foo: Checking requirements +[2024-06-05T15:24:49] INFO Link link-dst/foo -> src/foo: Requirement(s) ready +[2024-06-05T15:24:49] INFO Link link-dst/foo -> src/foo: Executing +[2024-06-05T15:24:49] INFO Link link-dst/foo -> src/foo: Final state: Ready +[2024-06-05T15:24:49] INFO Link link-dst/subdir/bar -> src/bar: Initial state: Not Ready +[2024-06-05T15:24:49] INFO Link link-dst/subdir/bar -> src/bar: Checking requirements +[2024-06-05T15:24:49] INFO Link link-dst/subdir/bar -> src/bar: Requirement(s) ready +[2024-06-05T15:24:49] INFO Link link-dst/subdir/bar -> src/bar: Executing +[2024-06-05T15:24:49] INFO Link link-dst/subdir/bar -> src/bar: Final state: Ready +[2024-06-05T15:24:49] INFO File links: Final state: Ready link-dst ├── foo -> ../src/foo diff --git a/recipe/meta.json b/recipe/meta.json index 09cf57924..7e5c59cd3 100644 --- a/recipe/meta.json +++ b/recipe/meta.json @@ -5,29 +5,30 @@ "packages": { "dev": [ "black =24.4.*", - "coverage =7.4.*", "docformatter =1.7.*", "f90nml =1.4.*", - "iotaa =0.7.*", + "iotaa =0.8.*", "isort =5.13.*", "jinja2 =3.1.*", "jq =1.7.*", - "jsonschema =4.21.*", - "lxml =5.1.*", + "jsonschema =4.22.*", + "lxml =5.2.*", "make >=3.8", - "mypy =1.9.*", + "mypy =1.10.*", "pip", - "pylint =3.1.*", - "pytest =8.1.*", + "pylint =3.2.*", + "pytest =8.2.*", + "pytest-cov =5.0.*", + "pytest-xdist =3.5.*", "python >=3.9,<3.13", "pyyaml =6.0.*" ], "run": [ "f90nml =1.4.*", - "iotaa =0.7.*", + "iotaa =0.8.*", "jinja2 =3.1.*", - "jsonschema =4.21.*", - "lxml =5.1.*", + "jsonschema =4.22.*", + "lxml =5.2.*", "python >=3.9,<3.13", "pyyaml =6.0.*" ] diff --git a/recipe/meta.yaml b/recipe/meta.yaml index cdf4234e0..0f3aed707 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -14,22 +14,23 @@ requirements: - pip run: - f90nml 1.4.* - - iotaa 0.7.* + - iotaa 0.8.* - jinja2 3.1.* - - jsonschema 4.21.* - - lxml 5.1.* + - jsonschema 4.22.* + - lxml 5.2.* - python >=3.9,<3.13 - pyyaml 6.0.* test: requires: - black 24.4.* - - coverage 7.4.* - docformatter 1.7.* - isort 5.13.* - jq 1.7.* - make >=3.8 - - mypy 1.9.* - - pylint 3.1.* - - pytest 8.1.* + - mypy 1.10.* + - pylint 3.2.* + - pytest 8.2.* + - pytest-cov 5.0.* + - pytest-xdist 3.5.* about: license: LGPL diff --git a/recipe/run_test.sh b/recipe/run_test.sh index e35443001..defba8696 100755 --- a/recipe/run_test.sh +++ b/recipe/run_test.sh @@ -23,7 +23,7 @@ lint() { msg Running linter ( set -eux - pylint . + pylint -j 4 . ) msg OK } @@ -45,8 +45,7 @@ unittest() { msg Running unit tests ( set -eux - coverage run -m pytest -vv . - coverage report + pytest --cov=uwtools -n 4 . ) msg OK } diff --git a/src/uwtools/tests/support.py b/src/uwtools/tests/support.py index c62344d41..81d6d42c3 100644 --- a/src/uwtools/tests/support.py +++ b/src/uwtools/tests/support.py @@ -60,17 +60,6 @@ def fixture_path(suffix: str = "") -> Path: return fixture_pathobj(suffix) -def fixture_uri(suffix: str = "") -> str: - """ - Returns a file:// URI path to a test-fixture resource file. - - :param suffix: A subpath relative to the location of the unit-test fixture resource files. The - prefix path to the resources files is known to Python and varies based on installation - location. - """ - return fixture_pathobj(suffix).as_uri() - - def logged(caplog: LogCaptureFixture, msg: str) -> bool: """ Does the given message occur in the log capture? diff --git a/src/uwtools/tests/utils/test_file.py b/src/uwtools/tests/utils/test_file.py index 177c34f91..560a50a4f 100644 --- a/src/uwtools/tests/utils/test_file.py +++ b/src/uwtools/tests/utils/test_file.py @@ -100,8 +100,10 @@ def test_readable_file(tmp_path): def test_readable_nofile(): - with file.readable() as f: - assert hasattr(f, "read") + file._stdinproxy.cache_clear() + with patch.object(sys, "stdin", new=StringIO("hello")): + with file.readable() as f: + assert f.read() == "hello" def test_resource_path():