0

Created this simple unit test as shown bellow

calculator_tester.py

import unittest
class MathsTest(unittest.TestCase):

    def test_createOperation(self):
        operation = Mathoperation()

This is the only test file I have created and Note there doesnot exist a class call Mathoperation() that is defined inside the test method. n When running this sample test code using the python test runner

python -m unittest

output:

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK

Expectation:

I was expecting the test case to run and throw NameError: global name Mathoperation is not defined. But the test case didn't run.

What is the sample test case not running. I am running it on python version 2.7.12

1 Answer 1

1

Test discovery looks for files matching the glob pattern test*.py by default. Your test doesn't match that pattern. Rename it, or specify the test file explicitly.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.