Skip to content

Commit

Permalink
Readme update, add summary
Browse files Browse the repository at this point in the history
  • Loading branch information
rogisolorzano committed Mar 14, 2023
1 parent 289fcf0 commit b595b90
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

Dead simple async unit test suite for micropython.

Work in progress. Mainly using it on things I'm building for fun and adding to it as needed.
![tests image](docs/tests.png)

This is a work in progress. Mainly using it on side projects and adding to it as needed.
I started this because I wanted to actually run my tests with `micropython` instead
of `python` for more reliability.

## Usage
Just copy `microtest.py` over to wherever you're using it.
Expand All @@ -15,3 +19,5 @@ Clone this repo and run `make tests`

You can reference `example.test.py` and the `Makefile` in this repo for tips on
running tests with the `micropython` binary.

I'm also using microtest in [microqueue](https://github.com/rogisolorzano/microqueue)
Binary file added docs/tests.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 9 additions & 2 deletions microtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,23 @@ def expect(value):
return Expect(value)

async def test(*functions):
print('------------------------------------------------')
print('\n------------------------------------------------')
passed = 0
failed = 0

for test_function in functions:
name = test_function.__name__.replace("_", " ")

try:
await test_function()
print('PASS', name)
passed += 1
except Exception as e:
print('FAIL', name)
print(e)
failed += 1

print('------------------------------------------------')
print('\nSummary')
print('-----------')
print('Passed: {}'.format(passed))
print('Failed: {}\n'.format(failed))

0 comments on commit b595b90

Please sign in to comment.