I have been trying to run unit tests using pytest.
I wrote a module with one class and some methods inside that class, and I wrote a unit test for this module (with a simple assert statement to check equality of lists) where I first instantiated the class with a list.
Then I invoke a method on that object (from the class). Both test.py
and the script to be tested are in the same folder. When I run pytest
on it, it reports "collected 0 items".
I am new to pytest
and but I am unable to run their examples successfully. What am I missing here?
I am running Python version 3.5.1 and pytest version 2.8.1 on Windows 7.
My test.py code:
from sort_algos import Sorts
def integer_sort_test():
myobject1 = Sorts([-100, 10, -10])
assert myobject1.merge_sort() == [-101, -100, 10]
sort_algos.py
is a module containing Sorts
class.
merge_sort
is a method from Sorts
.