简体   繁体   中英

GAE “Ran 0 tests” from unittest2

I'm attempting to implement unit tests as per GAE's Python SDK Setting up a testing framework section.

Using their sample test runner and test, I receive the following output:

Ran 0 tests in 0.000s

OK

I have unittest2 installed and I also tried running the following commands, but all yielded the same response:

python -m unittest discover ~/foldername
python -m unittest2 discover ~/foldername

I tried adding the Basic example test file from Python docs, but also got the same result.

Tried all of above with and without an __init__.py in the unit test's folder.

What should I try next to debug this issue?

Update

My directory structure is as below:

├── app.yaml
├── myclass.py
├── bulkloader.yaml
├── myappname.py
├── index.yaml
├── testmodel.py
├── test_runner.py
└── unit_tests
    ├── demotestcase.py
    └── sample.py

With the contents of both tests from the above referenced links.

Usage: python -m unittest discover [options]

-s directory     Directory to start discovery ('.' default)
-p pattern       Pattern to match test files ('test*.py' default)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM