https://github.com/simonlammer/testpythonscript
https://github.com/simonlammer/testpythonscript
hacktoberfest python3 testing
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/simonlammer/testpythonscript
- Owner: SimonLammer
- License: mit
- Created: 2020-09-17T04:49:00.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-10-21T18:16:00.000Z (over 3 years ago)
- Last Synced: 2025-04-05T20:43:13.572Z (over 1 year ago)
- Topics: hacktoberfest, python3, testing
- Language: Python
- Homepage:
- Size: 39.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# testpythonscript
This script provides a starting point to automate testing of other python scripts (e.g. student submissions).
## Usage
Consult `python3 test.py --help` for complete usage instructions.
You may wish to run these tests within a docker container (to make it more difficult for students to mess up your machine) with [this shell script](https://gist.github.com/SimonLammer/f863627f11221379d825f7a34d8f84c3)
### Example
Here's what happens when you run the current [`test.py`](./test.py) against [`sample_script.py`](./sample_script.py):
`python3 test.py sample_script.py`:
```
process 26916 is processing sample_script.py
process 26916 finished with exit code 0
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Output of sample_script.py test (exitcode 0):
test_false (__main__.Test) ... FAIL
test_foo (__main__.Test) ... ok
test_initial_attributes (__main__.Test) ... ok
test_library_load_stdin (__main__.Test) ... ok
test_skip_decorator (__main__.Test) ... skipped 'This is how you can skip tests.'
test_skip_self (__main__.Test) ... skipped 'You can also skip tests this way.'
======================================================================
FAIL: test_false (__main__.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test.py", line 36, in inner
func(*args, stdout, stderr, **kwargs)
File "test.py", line 70, in test_false
self.assertTrue(LIBRARY.return_true())
AssertionError: False is not true
----------------------------------------------------------------------
Ran 6 tests in 0.001s
FAILED (failures=1, skipped=2)
Completed testing sample_script.py
```