You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
5 years ago | |
|---|---|---|
| .. | ||
| README.md | 5 years ago | |
| config.ini | 5 years ago | |
| test_package_versions.py | 5 years ago | |
README.md
Testing
Welcome to the testing folder. Here, you will find tests to promote quality of content and environment. This is in development.
Using the Utility
- Clone this repo locally to your machine
- Move into the
/testsfolder using a terminal - If desired, activate the virtual environment you will be using for this course
- Run
python test_package_versions.pyfrom the terminal - A successful result looks as follows (note the OK) at the bottom. NOTE: the number of tests may differ as the curriculum evolves. The important metric is that all tests pass:
$ python test_package_versions.py
test_flask (__main__.TestPkgVersions) ... ok
test_matplotlib (__main__.TestPkgVersions) ... ok
test_notebook (__main__.TestPkgVersions) ... ok
test_numpy (__main__.TestPkgVersions) ... ok
test_pandas (__main__.TestPkgVersions) ... ok
test_requests (__main__.TestPkgVersions) ... ok
----------------------------------------------------------------------
Ran 6 tests in 0.545s
OK
- A failed result looks as follows.
- Note the
FAILED (failures=2)at the bottom - Here, we can see that the versions of matplotlib and requests are not sufficient for the requirements and must be updated:
- Note the
$ python test_package_versions.py
test_flask (__main__.TestPkgVersions) ... ok
test_matplotlib (__main__.TestPkgVersions) ... FAIL
test_notebook (__main__.TestPkgVersions) ... ok
test_numpy (__main__.TestPkgVersions) ... ok
test_pandas (__main__.TestPkgVersions) ... ok
test_requests (__main__.TestPkgVersions) ... FAIL
======================================================================
FAIL: test_matplotlib (__main__.TestPkgVersions)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_package_versions.py", line 14, in test
self.assertTrue(importlib.import_module(pkg).__version__ >= v)
AssertionError: False is not true
======================================================================
FAIL: test_requests (__main__.TestPkgVersions)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_package_versions.py", line 14, in test
self.assertTrue(importlib.import_module(pkg).__version__ >= v)
AssertionError: False is not true
----------------------------------------------------------------------
Ran 6 tests in 0.544s
FAILED (failures=2)
For Instructor Use
- To add additional libraries to be checked, add the name of the library and the minimum required version, to the
config.inifile. Thetest_package_versions.pyscript will parse theconfig.inifile when it is executed- Note that versions greater than or equal to the specified version in
config.iniwill pass tests
- Note that versions greater than or equal to the specified version in
- The
/config.inifile is built to contain all parameters needed for this and future testing- Please use configparser, not yaml, as configparser is
- more readable than json, and
- does not have external dependencies as pyyaml does
- Please use configparser, not yaml, as configparser is
- It is important to note that there are no external dependencies for this testing folder, all libraries used are pure python
- This is intentional - this repo is designed to be used on a completely vanilla python3 machine; the testing framework itself must exist for other items to be tested (why
pytestwas not used)