Skip to content
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

Does not execute unittests #2

Open
ashwinvis opened this issue Jun 18, 2019 · 1 comment
Open

Does not execute unittests #2

ashwinvis opened this issue Jun 18, 2019 · 1 comment

Comments

@ashwinvis
Copy link
Contributor

  • quickfix.py version: 0.0.0
  • Python version: 3.7.3
  • Operating System: Linux

Description

quickfix.py cannot run a file containing a unittest testcase.

What I Did

Create a file called unittest_failure.py

import unittest



class FalingTest(unittest.TestCase):
    def test_oops(self):
        raise ValueError("Oops!")


if __name__ == "__main__":
    unittest.main()
❯❯❯ python unittest_failure.py                                                                                                        (quickfix.py)
E
======================================================================
ERROR: test_oops (__main__.FalingTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "unittest_failure.py", line 7, in test_oops
    raise ValueError("Oops!")
ValueError: Oops!

----------------------------------------------------------------------
Ran 1 test in 0.000s

❯❯❯ quickfix.py unittest_failure.py                                                                                                  (quickfix.py)

----------------------------------------------------------------------
Ran 0 tests in 0.000s
@tonyxty
Copy link
Owner

tonyxty commented Jun 21, 2019

Well the problem here is two-fold:

First, the test didn't run at all. This is fixed in 0e3c29d (along with other potential behavior difference).

Second, the test failure is not caught. This one is more tricky though, since unittest.main() raises no exceptions. To make quickfix.py work with unittests properly, we probably need to monkey-patch the unittest module a little bit (maybe add a new command line switch for that).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants