-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from MagnivOrg/test-restructuring
Test restructuring
- Loading branch information
Showing
12 changed files
with
23 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,9 @@ | ||
### Magniv tests | ||
|
||
Goal: Create robust comprehensive unit and integration tests to empower fast development. | ||
|
||
Structure: all tests stored in top level folder called “tests” inner folders structured by test type eg | ||
|
||
-Tests | ||
|
||
``` | ||
- unit_tests | ||
- integration_tests | ||
- standalone_tests | ||
Test structure corresponds to directory structure within `magniv-core\magniv`: | ||
- build | ||
- core | ||
- export | ||
- run | ||
- scripts | ||
- utils | ||
``` | ||
|
||
Stack: | ||
|
||
``` | ||
pytest | ||
https://github.com/pytest-dev/pytest | ||
coverage | ||
https://github.com/nedbat/coveragepy | ||
``` | ||
|
||
Schematics: | ||
|
||
``` | ||
build.py: | ||
integration_tests: | ||
todo: | ||
- test where there are nested folders with tasks in them, make sure that all those tasks show in the `dump.json` and that the `dump.json` is accurate | ||
- test when there are multiple task files in the same folder and make sure all of them show up | ||
- test when there is a nested folder that has its own `requirements.txt` -- verify that the `dump.json` reflects that the correct `requirements.txt` is being used | ||
- test when there is a nested folder w/o a `requirements.txt`, make sure it uses the next parents `requirements.txt` | ||
- test_name | ||
unit_tests: | ||
todo: | ||
test_build.py: | ||
- requirements in nested dir | ||
- requirements top level dir | ||
- gets list of decorated nodes from ast | ||
- gets all decorated tasks from file as list | ||
- finds all files in dir that have magniv task decorators | ||
- saves dump.json to expected path | ||
- throws oserror if no file with decorated task is found | ||
- throws oserror if dir specified dir not found | ||
- multiple tasks within one file | ||
test_build_imports.py | ||
- import magniv | ||
- from magniv.core import task | ||
- from magniv import core as ___ | ||
|
||
``` | ||
A unit test for a given method should be created under the directory that corresponds to where the original method lives in the codebase. Integration tests can be added separately if they are implemented. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# TESTS IN THIS DIRECTORY SHOULD TEST CODE UNDER magniv\build |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
tests/unit_tests/test_get_decorated_nodes.py → ...s/build_tests/test_get_decorated_nodes.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
tests/unit_tests/test_invalid_build.py → tests/build_tests/test_invalid_build.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# TESTS IN THIS DIRECTORY SHOULD TEST CODE UNDER magniv\core |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from magniv.core.task import task | ||
|
||
|
||
class TestTask: | ||
def test_task_does_not_fail(self): | ||
assert task() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# TESTS IN THIS DIRECTORY SHOULD TEST CODE UNDER magniv\export |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# TODO: implement export testing |
Empty file.