-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[jit] Move Python 3 tests to their own file #21489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
||
|
|
||
| @unittest.skipIf(PY2, "tuple printing in py2 is different than torchscript") | ||
| def test_string_print(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was deleted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| self.assertExpected(str(ast)) | ||
|
|
||
| @unittest.skipIf(PY2, "Requires python 3") | ||
| def test_python_frontend_py3(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also deleted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| @unittest.skipIf(not PY35, "Python 3.5 needed") | ||
| def test_matmul_py3(self): | ||
| code = dedent(""" | ||
| def fn(a, b): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's moved, the _py3 was removed
| pass | ||
|
|
||
|
|
||
| def check_test_defined_in_running_script(test_case): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this removed ?
eellison
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good but i think you need FBCode changes so the test runs internally
|
The assert exists because people sometimes imported |
ezyang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please figure out why the assert was twinging.
Summary: Class member annotations can be marked with `Final[T]` instead of adding them to `__constants__`. `Final` comes from the `typing_extensions` module (which will be used if it is present). If not, the polyfill from `_jit_internal` is exposed as `torch.jit.Final` for users that don't want to install `typing_extensions`. This keeps around `__constants__` since a lot of code is still using it, but in documentation follow ups we should change the examples to all to use `Final`. TODO: install typing_extensions on CI, move tests to a Python3 only file when #21489 lands ](https://our.intern.facebook.com/intern/diff/15746274/) Pull Request resolved: #21603 Pulled By: driazati Differential Revision: D15746274 fbshipit-source-id: d2c9b5643b4abba069b130c26fd42714c906ffac
Keeping them in their own file lets us use Python3 syntax directly instead of going through the string frontend
This also deletes an assert added in #13250, cc @ezyang do you know why this check was added in the first place?
The test cases defined outside
test_jit.pywork fine with Python's unittest runner. Pytest doesn't find them though, so to use Pytest for those files you have to run the file directly instead of doingpytest test_jit.pyDifferential Revision: D15704079