Skip to content

Fix test_nss.py import error when ng_model_gym is not installed#17184

Open
apullin wants to merge 1 commit intopytorch:mainfrom
apullin:export-D92206283
Open

Fix test_nss.py import error when ng_model_gym is not installed#17184
apullin wants to merge 1 commit intopytorch:mainfrom
apullin:export-D92206283

Conversation

@apullin
Copy link
Contributor

@apullin apullin commented Feb 3, 2026

Summary:
Fixes test collection failure in CI when ng_model_gym is not installed.

The test_nss.py file imports ng_model_gym at module level, which requires pydantic. In CI environments where these dependencies are not installed, pytest fails during test collection with ModuleNotFoundError: No module named 'pydantic'.

This fix adds pytest.importorskip("ng_model_gym") before the import, which gracefully skips the entire test module when the dependency is unavailable instead of failing test collection.

Generated by Confucius Code Assist (CCA)
Confucius Session, Trace

Differential Revision: D92206283

@apullin apullin requested a review from digantdesai as a code owner February 3, 2026 23:22
@pytorch-bot
Copy link

pytorch-bot bot commented Feb 3, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/17184

Note: Links to docs will display an error until the docs builds have been completed.

❌ 3 Awaiting Approval, 2 New Failures

As of commit 3a0eb15 with merge base c0cef6c (image):

AWAITING APPROVAL - The following workflows need approval before CI can run:

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 3, 2026
@github-actions
Copy link

github-actions bot commented Feb 3, 2026

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@meta-codesync
Copy link
Contributor

meta-codesync bot commented Feb 3, 2026

@apullin has exported this pull request. If you are a Meta employee, you can view the originating Diff in D92206283.

apullin pushed a commit to apullin/executorch that referenced this pull request Feb 3, 2026
…rch#17184)

Summary:

Fixes test collection failure in CI when `ng_model_gym` is not installed.

The `test_nss.py` file imports `ng_model_gym` at module level, which requires `pydantic`. In CI environments where these dependencies are not installed, pytest fails during test collection with `ModuleNotFoundError: No module named 'pydantic'`.

This fix adds `pytest.importorskip("ng_model_gym")` before the import, which gracefully skips the entire test module when the dependency is unavailable instead of failing test collection.
---
> Generated by [Confucius Code Assist (CCA)](https://www.internalfb.com/wiki/Confucius/Analect/Shared_Analects/Confucius_Code_Assist_(CCA)/)
[Confucius Session](https://www.internalfb.com/confucius?host=44014.od.fbinfra.net&port=8086&tab=Chat&session_id=3841a0f6-014b-11f1-919a-6b37349122a8&entry_name=Code+Assist), [Trace](https://www.internalfb.com/confucius?session_id=3841a0f6-014b-11f1-919a-6b37349122a8&tab=Trace)

Differential Revision: D92206283
apullin pushed a commit to apullin/executorch that referenced this pull request Feb 3, 2026
…rch#17184)

Summary:

Fixes test collection failure in CI when `ng_model_gym` is not installed.

The `test_nss.py` file imports `ng_model_gym` at module level, which requires `pydantic`. In CI environments where these dependencies are not installed, pytest fails during test collection with `ModuleNotFoundError: No module named 'pydantic'`.

This fix adds `pytest.importorskip("ng_model_gym")` before the import, which gracefully skips the entire test module when the dependency is unavailable instead of failing test collection.
---
> Generated by [Confucius Code Assist (CCA)](https://www.internalfb.com/wiki/Confucius/Analect/Shared_Analects/Confucius_Code_Assist_(CCA)/)
[Confucius Session](https://www.internalfb.com/confucius?host=44014.od.fbinfra.net&port=8086&tab=Chat&session_id=3841a0f6-014b-11f1-919a-6b37349122a8&entry_name=Code+Assist), [Trace](https://www.internalfb.com/confucius?session_id=3841a0f6-014b-11f1-919a-6b37349122a8&tab=Trace)

Differential Revision: D92206283
apullin pushed a commit to apullin/executorch that referenced this pull request Feb 3, 2026
…rch#17184)

Summary:

Fixes test collection failure in CI when `ng_model_gym` is not installed.

The `test_nss.py` file imports `ng_model_gym` at module level, which requires `pydantic`. In CI environments where these dependencies are not installed, pytest fails during test collection with `ModuleNotFoundError: No module named 'pydantic'`.

This fix adds `pytest.importorskip("ng_model_gym")` before the import, which gracefully skips the entire test module when the dependency is unavailable instead of failing test collection.
---
> Generated by [Confucius Code Assist (CCA)](https://www.internalfb.com/wiki/Confucius/Analect/Shared_Analects/Confucius_Code_Assist_(CCA)/)
[Confucius Session](https://www.internalfb.com/confucius?host=44014.od.fbinfra.net&port=8086&tab=Chat&session_id=3841a0f6-014b-11f1-919a-6b37349122a8&entry_name=Code+Assist), [Trace](https://www.internalfb.com/confucius?session_id=3841a0f6-014b-11f1-919a-6b37349122a8&tab=Trace)

Differential Revision: D92206283
apullin pushed a commit to apullin/executorch that referenced this pull request Feb 3, 2026
…rch#17184)

Summary:

Fixes test collection failure in CI when `ng_model_gym` is not installed.

The `test_nss.py` file imports `ng_model_gym` at module level, which requires `pydantic`. In CI environments where these dependencies are not installed, pytest fails during test collection with `ModuleNotFoundError: No module named 'pydantic'`.

This fix adds `pytest.importorskip("ng_model_gym")` before the import, which gracefully skips the entire test module when the dependency is unavailable instead of failing test collection.
---
> Generated by [Confucius Code Assist (CCA)](https://www.internalfb.com/wiki/Confucius/Analect/Shared_Analects/Confucius_Code_Assist_(CCA)/)
[Confucius Session](https://www.internalfb.com/confucius?host=44014.od.fbinfra.net&port=8086&tab=Chat&session_id=3841a0f6-014b-11f1-919a-6b37349122a8&entry_name=Code+Assist), [Trace](https://www.internalfb.com/confucius?session_id=3841a0f6-014b-11f1-919a-6b37349122a8&tab=Trace)

Differential Revision: D92206283
apullin pushed a commit to apullin/executorch that referenced this pull request Feb 3, 2026
…rch#17184)

Summary:

Fixes test collection failure in CI when `ng_model_gym` is not installed.

The `test_nss.py` file imports `ng_model_gym` at module level, which requires `pydantic`. In CI environments where these dependencies are not installed, pytest fails during test collection with `ModuleNotFoundError: No module named 'pydantic'`.

This fix adds `pytest.importorskip("ng_model_gym")` before the import, which gracefully skips the entire test module when the dependency is unavailable instead of failing test collection.
---
> Generated by [Confucius Code Assist (CCA)](https://www.internalfb.com/wiki/Confucius/Analect/Shared_Analects/Confucius_Code_Assist_(CCA)/)
[Confucius Session](https://www.internalfb.com/confucius?host=44014.od.fbinfra.net&port=8086&tab=Chat&session_id=3841a0f6-014b-11f1-919a-6b37349122a8&entry_name=Code+Assist), [Trace](https://www.internalfb.com/confucius?session_id=3841a0f6-014b-11f1-919a-6b37349122a8&tab=Trace)

Differential Revision: D92206283
…rch#17184)

Summary:

Fixes test collection failure in CI when `ng_model_gym` is not installed.

The `test_nss.py` file imports `ng_model_gym` at module level, which requires `pydantic`. In CI environments where these dependencies are not installed, pytest fails during test collection with `ModuleNotFoundError: No module named 'pydantic'`.

This fix adds `pytest.importorskip("ng_model_gym")` before the import, which gracefully skips the entire test module when the dependency is unavailable instead of failing test collection.
---
> Generated by [Confucius Code Assist (CCA)](https://www.internalfb.com/wiki/Confucius/Analect/Shared_Analects/Confucius_Code_Assist_(CCA)/)
[Confucius Session](https://www.internalfb.com/confucius?host=44014.od.fbinfra.net&port=8086&tab=Chat&session_id=3841a0f6-014b-11f1-919a-6b37349122a8&entry_name=Code+Assist), [Trace](https://www.internalfb.com/confucius?session_id=3841a0f6-014b-11f1-919a-6b37349122a8&tab=Trace)

Differential Revision: D92206283
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant