Open wujingyue opened 2 weeks ago
This TestCase
comes from torch.testing._internal.common_utils
: https://github.com/pytorch/pytorch/blob/6d8c9be54bd78846aa7c55625deec11b10ae544f/torch/testing/_internal/common_utils.py#L2773.
TestCase
is further derived from expecttest
. I need to check if expecttest
uses UnitTest
.
We use some assert methods from TestCase
like assertEqual
or assertTrue
which should be replacable to avoid inheriting from TestCase
.
expecttest
should work with both pytest
and unittest
based on their documentation: https://github.com/pytorch/expecttest
Good to know that! It seems to say expecttest is expected to work under the pytest runner. However, I don't think expecttest is claimed to be compatible with all pytest features, e.g., fixtures in this particular example. That's at least my impression from https://github.com/pytorch/pytorch/issues/11578#issuecomment-627688827, and thanks @IvanYashchuk for the pointer.
https://github.com/NVIDIA/Fuser/compare/wjy/pytest?expand=1 is a failed attempt of mine.
Currently, Python distributed tests rely on mpi_test to get ranks, sizes and the barrier. After we expose Communicator via nvfuser's Python API, we should be able to replace the mpi_test fixture with a singleton nvfuser.communicator.
However, this indicates a general problem of incompatibility between pytest and unittest as discussed https://github.com/NVIDIA/Fuser/pull/3192#discussion_r1802331505. Apparently, pytest fixture and unittest.TestCase don't like each other.
cc @Priya2698 and @rdspring1