Skip to content

hide top-level test functions from pytest's traceback #58915

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

Closed
wants to merge 4 commits into from

Conversation

pmeier
Copy link
Collaborator

@pmeier pmeier commented May 25, 2021

Stack from ghstack:

History:

Since PyTorch shouldn't be the only user of assert_(equal|close) we
add it here to the top-level functions assert_(equal|close). If
pytest is used without --tb=native, the traceback for

assert torch.eq(actual, expected), "Tensors are not equal!"
torch.testing.assert_equal(actual, expected)

looks the same, making it more concise.

Differential Revision: D29259406

History:

- It was included for internal helper functions in the initial proposal
  in #53820
- It was removed in #54780, since it is not honored when used with
  `pytest`'s `--tb=native`, which is the default for PyTorch

Since PyTorch shouldn't be the only user of `assert_(equal|close)` we
add it here to the top-level functions `assert_(equal|close)`. If
`pytest` is used without `--tb=native`, the traceback for

```python
assert torch.eq(actual, expected), "Tensors are not equal!"
torch.testing.assert_equal(actual, expected)
```

looks the same, making it more concise.

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented May 25, 2021

💊 CI failures summary and remediations

As of commit e59d862 (more details on the Dr. CI page and at hud.pytorch.org/pr/58915):


💚 💚 Looks good so far! There are no failures yet. 💚 💚


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

Copy link
Collaborator

@mruberry mruberry left a comment

Choose a reason for hiding this comment

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

OK

History:

- It was included for internal helper functions in the initial proposal
  in #53820
- It was removed in #54780, since it is not honored when used with
  `pytest`'s `--tb=native`, which is the default for PyTorch

Since PyTorch shouldn't be the only user of `assert_(equal|close)` we
add it here to the top-level functions `assert_(equal|close)`. If
`pytest` is used without `--tb=native`, the traceback for

```python
assert torch.eq(actual, expected), "Tensors are not equal!"
torch.testing.assert_equal(actual, expected)
```

looks the same, making it more concise.

[ghstack-poisoned]
History:

- It was included for internal helper functions in the initial proposal
  in #53820
- It was removed in #54780, since it is not honored when used with
  `pytest`'s `--tb=native`, which is the default for PyTorch

Since PyTorch shouldn't be the only user of `assert_(equal|close)` we
add it here to the top-level functions `assert_(equal|close)`. If
`pytest` is used without `--tb=native`, the traceback for

```python
assert torch.eq(actual, expected), "Tensors are not equal!"
torch.testing.assert_equal(actual, expected)
```

looks the same, making it more concise.

[ghstack-poisoned]
History:

- It was included for internal helper functions in the initial proposal
  in #53820
- It was removed in #54780, since it is not honored when used with
  `pytest`'s `--tb=native`, which is the default for PyTorch

Since PyTorch shouldn't be the only user of `assert_(equal|close)` we
add it here to the top-level functions `assert_(equal|close)`. If
`pytest` is used without `--tb=native`, the traceback for

```python
assert torch.eq(actual, expected), "Tensors are not equal!"
torch.testing.assert_equal(actual, expected)
```

looks the same, making it more concise.

[ghstack-poisoned]
@mruberry
Copy link
Collaborator

@mruberry has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@mruberry merged this pull request in 9fffd05.

@facebook-github-bot facebook-github-bot deleted the gh/pmeier/16/head branch June 25, 2021 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla signed Merged module: testing Issues related to the torch.testing module (not tests) open source
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants