Skip to content

Commit

Permalink
Adds the basis for testing Python code using the hypothesis framework.
Browse files Browse the repository at this point in the history
  • Loading branch information
Devin Smith authored and adammichaelwood committed Aug 24, 2018
1 parent 4502852 commit f030905
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,10 @@ tmp*
# literate programming
style-checks.py
extra.py

# Testing
.hypothesis/
.pytest_cache/

# IDE files
.idea/
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,6 @@ odk1-check: odk1-style-check odk1-spell-check
odk2-check: odk2-style-check odk2-spell-check

check-all: odk1-check odk2-check

test:
pytest
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ You can also use `make` to build both ODK and ODK2 docs, or to run just a portio

For both ODK 1 and ODK 2:

| | Build | Clean | Check Style & Spell |
| -------- | :---------: | :-----------: | :-----------------: |
| **Options** | build-all | clean | check-all |
| | Build | Clean | Check Style & Spell | Test |
| -------- | :---------: | :-----------: | :-------------------------: | :--------: |
| **Options** | build-all | clean | check-all | test |

For a specific ODK version:

Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ Pillow==4.3.0
proselint
blessings
gitpython
sphinx-tabs==1.1.7
sphinx-tabs==1.1.7
hypothesis==3.69.1
pytest==3.7.2
10 changes: 10 additions & 0 deletions tests/test_style_guide.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from hypothesis import given, example

from hypothesis import strategies as st

HELLO_MSG = 'Hello Hypothesis'


@given(st.just(HELLO_MSG))
def test_framework(s):
assert s == HELLO_MSG

0 comments on commit f030905

Please sign in to comment.