Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion skyrl-train/tests/gpu/gpu_ci/test_verifiers_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from tests.gpu.utils import get_test_actor_config, init_inference_engines
from skyrl_train.inference_engines.inference_engine_client import InferenceEngineClient
from skyrl_train.inference_engines.utils import get_sampling_params_for_backend
from integrations.verifiers.verifiers_generator import VerifiersGenerator

# Mark all tests in this file as "integrations"
pytestmark = pytest.mark.integrations
Expand Down Expand Up @@ -88,6 +87,7 @@ async def _run_verifiers_end_to_end(
}
)

from integrations.verifiers.verifiers_generator import VerifiersGenerator
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While this local import solves the ImportError during test collection, a more idiomatic pytest approach is to use pytest.importorskip() at the top of the test module. This would allow you to keep the VerifiersGenerator import at the top level, and it would clearly mark all tests in this file to be skipped if the verifiers package isn't installed. This is often cleaner and more maintainable for test files that depend on optional integrations.

For example, you could add the following at the top of the file and remove this local import:

import pytest

pytest.importorskip("verifiers")

from integrations.verifiers.verifiers_generator import VerifiersGenerator

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, that might be true but I also don't want tests to be silently skipped

generator = VerifiersGenerator(
generator_cfg=generator_cfg,
tokenizer=tokenizer,
Expand Down
Loading