8000 Add infra to run CPython tests under Dynamo · pytorch/pytorch@cd77889 · GitHub
[go: up one dir, main page]

Skip to content

Commit cd77889

Browse files
Add infra to run CPython tests under Dynamo
ghstack-source-id: ab813a2 Pull Request resolved: #150787
1 parent b06cbd4 commit cd77889

File tree

14 files changed

+181
-2196
lines changed

14 files changed

+181
-2196
lines changed

.lintrunner.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ exclude_patterns = [
1818
'torch/_inductor/autoheuristic/artifacts/**',
1919
'scripts/**',
2020
'test/generated_type_hints_smoketest.py',
21+
# CPython tests
22+
'test/dynamo/cpython/**',
2123
# Tests from the NumPy test suite
2224
'test/torch_np/numpy_test/**/*.py',
2325
'third_party/**',
@@ -398,6 +400,7 @@ exclude_patterns=[
398400
'tools/clang_format_hash/**',
399401
'test/cpp/jit/upgrader_models/*.ptl',
400402
'test/cpp/jit/upgrader_models/*.ptl.ff',
403+
'test/dynamo/cpython/**',
401404
'**/*.png',
402405
'**/*.gz',
403406
'**/*.patch',
@@ -936,6 +939,7 @@ include_patterns = [
936939
exclude_patterns = [
937940
'test/run_test.py',
938941
'**/fb/**',
942+
'test/dynamo/cpython/3.13/**',
939943
'test/quantization/**', # should be run through test/test_quantization.py
940944
'test/jit/**', # should be run through test/test_jit.py
941945
'test/ao/sparsity/**', # should be run through test/test_ao_sparsity.py
@@ -1131,6 +1135,7 @@ exclude_patterns = [
11311135
'caffe2/**/*.pyi',
11321136
'fb/**',
11331137
'**/fb/**',
1138+
'test/dynamo/cpython/**',
11341139
'third_party/**/*.py',
11351140
'third_party/**/*.pyi',
11361141
'torch/_vendor/**',
@@ -1536,6 +1541,7 @@ exclude_patterns = [
15361541
'functorch/notebooks/**',
15371542
'torch/_inductor/fx_passes/serialized_patterns/**',
15381543
'torch/_inductor/autoheuristic/artifacts/**',
1544+
'test/dynamo/cpython/**',
15391545
'scripts/**',
15401546
'third_party/**',
15411547
'fb/**',

test/dynamo/cpython/3_13/CHANGES.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
This subdirectory contains a selection of tests from the CPython repository (branch: v3.13.0):\
2+
https://github.com/python/cpython/releases/tag/v3.13.0
3+
4+
Modifications were made to ensure compatibility with the Dynamo infrastructure:
5+
+ Monkey-patched `unittest.TestCase` to `torch._dynamo.test_case.CPythonTestCase`.
6+
+ Replaced `unittest.main()` with `torch._dynamo.test_case.run_tests()`.
7+
+ Assigned test "owners."
8+
+ Annotated CPU-intensive tests with the `@slowTest` decorator.
9+
+ Adjusted imports to use `import module` instead of `from test import module`.

test/dynamo/cpython/3_13/LICENSE

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
2+
--------------------------------------------
3+
4+
1. This LICENSE AGREEMENT is between the Python Software Foundation
5+
("PSF"), and the Individual or Organization ("Licensee") accessing and
6+
otherwise using this software ("Python") in source or binary form and
7+
its associated documentation.
8+
9+
2. Subject to the t 8000 erms and conditions of this License Agreement, PSF hereby
10+
grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
11+
analyze, test, perform and/or display publicly, prepare derivative works,
12+
distribute, and otherwise use Python alone or in any derivative version,
13+
provided, however, that PSF's License Agreement and PSF's notice of copyright,
14+
i.e., "Copyright (c) 2001 Python Software Foundation; All Rights Reserved"
15+
are retained in Python alone or in any derivative version prepared by Licensee.
16+
17+
3. In the event Licensee prepares a derivative work that is based on
18+
or incorporates Python or any part thereof, and wants to make
19+
the derivative work available to others as provided herein, then
20+
Licensee hereby agrees to include in any such work a brief summary of
21+
the changes made to Python.
22+
23+
4. PSF is making Python available to Licensee on an "AS IS"
24+
basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
25+
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
26+
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
27+
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
28+
INFRINGE ANY THIRD PARTY RIGHTS.
29+
30+
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
31+
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
32+
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
33+
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
34+
35+
6. This License Agreement will automatically terminate upon a material
36+
breach of its terms and conditions.
37+
38+
7. Nothing in this License Agreement shall be deemed to create any
39+
relationship of agency, partnership, or joint venture between PSF and
40+
Licensee. This License Agreement does not grant permission to use PSF
41+
trademarks or trade name in a trademark sense to endorse or promote
42+
products or services of Licensee, or any third party.
43+
44+
8. By copying, installing or otherwise using Python, Licensee
45+
agrees to be bound by the terms and conditions of this License
46+
Agreement.

0 commit comments

Comments
 (0)
0