Python pytest installed, running, but discovers no tests

python

#1
  1. I have created, in the root of my python workspace, the first example from [http://doc.pytest.org/en/latest/index.html]

content of test_sample.py

def func(x):
return x + 1

def test_answer():
assert func(3) == 5

  1. I have (successfully?) installed pytest using sudo easyinstall, as recommended.

friedeggs:~/workspace $ sudo easy_install pytest

3. pytest clearly executes, as follows, but does not appear to discover the file test_sample.py:

friedeggs:~/workspace $ pytest
========================= test session starts ==========================
platform linux2 – Python 2.7.6, pytest-3.0.6, py-1.4.32, pluggy-0.4.0
rootdir: /home/ubuntu/workspace, inifile:
collected 0 items

===================== no tests ran in 0.01 seconds =====================

  1. I corrupted the test file name, and tried again. This seemed to indicate that the test file was indeed seen, hence the error about the filename. However pytest, as I installed it in c9, will not process a valid file, as in step 3, and appears not to see it. Disappointed to be thwarted at this elementary stage.

friedeggs:~/workspace $ pytest
========================= test session starts ==========================
platform linux2 – Python 2.7.6, pytest-3.0.6, py-1.4.32, pluggy-0.4.0
rootdir: /home/ubuntu/workspace, inifile:
collected 0 items / 1 errors

================================ ERRORS ================================
___________________ ERROR collecting test_sampl.e.py ___________________
ImportError while importing test module ‘/home/ubuntu/workspace/test_sampl.e.py’.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
ImportError: No module named test_sampl.e
!!! Interrupted: 1 errors during collection !!!
======================= 1 error in 0.15 seconds ========================
friedeggs:~/workspace $ pytest
========================= test session starts ==========================
platform linux2 – Python 2.7.6, pytest-3.0.6, py-1.4.32, pluggy-0.4.0
rootdir: /home/ubuntu/workspace, inifile:
collected 0 items

===================== no tests ran in 0.01 seconds =====================