Skip to content

Commit 031b279

Browse files
sayakpaulDN6hf-security-analysis[bot]
authored
spit output to stderr when extracting GPU tests for PRs (#14847)
* update * don't use xdist during gpu tests in PRs. * Revert "update" This reverts commit 0906d05. * fix(ci): harden GitHub Actions workflows (#14847) (#14849) fix(ci): harden workflow files flagged on #14847 Co-authored-by: hf-security-analysis[bot] <265538906+hf-security-analysis[bot]@users.noreply.github.com> * redirect to stderr --------- Co-authored-by: DN6 <dhruv.nair@gmail.com> Co-authored-by: hf-security-analysis[bot] <265538906+hf-security-analysis[bot]@users.noreply.github.com>
1 parent 56aa3cd commit 031b279

1 file changed

Lines changed: 33 additions & 31 deletions

File tree

‎utils/extract_tests_from_mixin.py‎

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import argparse
22
import inspect
33
import sys
4+
from contextlib import redirect_stdout
45
from pathlib import Path
56
from typing import List, Type
67

@@ -41,35 +42,36 @@ def generate_pattern_for_mixins(mixin_classes: List[Type]) -> str:
4142

4243

4344
if __name__ == "__main__":
44-
mixin_classes = []
45-
if args.type == "pipeline":
46-
from tests.pipelines.test_pipelines_common import PipelineTesterMixin
47-
48-
mixin_classes = [PipelineTesterMixin]
49-
50-
elif args.type == "models":
51-
# The model tester suite is split across several mixins under `tests/models/testing_utils`,
52-
# so aggregate their test methods to reconstruct the full coverage.
53-
from tests.models.testing_utils import (
54-
AttentionTesterMixin,
55-
LoraTesterMixin,
56-
MemoryTesterMixin,
57-
ModelTesterMixin,
58-
TrainingTesterMixin,
59-
)
60-
61-
mixin_classes = [
62-
ModelTesterMixin,
63-
MemoryTesterMixin,
64-
TrainingTesterMixin,
65-
AttentionTesterMixin,
66-
LoraTesterMixin,
67-
]
68-
69-
elif args.type == "lora":
70-
from tests.lora.utils import PeftLoraLoaderMixinTests
71-
72-
mixin_classes = [PeftLoraLoaderMixinTests]
73-
74-
pattern = generate_pattern_for_mixins(mixin_classes)
45+
with redirect_stdout(sys.stderr):
46+
mixin_classes = []
47+
if args.type == "pipeline":
48+
from tests.pipelines.test_pipelines_common import PipelineTesterMixin
49+
50+
mixin_classes = [PipelineTesterMixin]
51+
52+
elif args.type == "models":
53+
# The model tester suite is split across several mixins under `tests/models/testing_utils`,
54+
# so aggregate their test methods to reconstruct the full coverage.
55+
from tests.models.testing_utils import (
56+
AttentionTesterMixin,
57+
LoraTesterMixin,
58+
MemoryTesterMixin,
59+
ModelTesterMixin,
60+
TrainingTesterMixin,
61+
)
62+
63+
mixin_classes = [
64+
ModelTesterMixin,
65+
MemoryTesterMixin,
66+
TrainingTesterMixin,
67+
AttentionTesterMixin,
68+
LoraTesterMixin,
69+
]
70+
71+
elif args.type == "lora":
72+
from tests.lora.utils import PeftLoraLoaderMixinTests
73+
74+
mixin_classes = [PeftLoraLoaderMixinTests]
75+
76+
pattern = generate_pattern_for_mixins(mixin_classes)
7577
print(pattern)

0 commit comments

Comments
 (0)