Skip to content

Commit

Permalink
Add more steps to pytest, fully remove behave (#1347)
Browse files Browse the repository at this point in the history
* update yaml loader to new method

* Add config overrides steps to pytest

This requires some patching around the config object, which now happens
in every test.

Co-authored-by: Micah Jerome Ellison <[email protected]>

* udpate docs for new tests

* remove behave from deps

* remove feature dir from flake8 checks

* udpate lock file

* disable pip version check (it keeps spamming the pipeline)

Co-authored-by: Micah Jerome Ellison <[email protected]>
  • Loading branch information
wren and micahellison authored Oct 9, 2021
1 parent a98f3f7 commit 44edb9b
Show file tree
Hide file tree
Showing 112 changed files with 265 additions and 4,815 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
if: ${{ matrix.python-version != '3.10-dev' }}
run: |
echo '::group::poetry'
pip install poetry
pip --disable-pip-version-check install poetry
poetry config --local virtualenvs.in-project true
echo '::endgroup::'
Expand All @@ -70,7 +70,7 @@ jobs:
if: ${{ matrix.python-version == '3.10-dev' }}
run: |
echo '::group::poetry'
pip install poetry==1.2.0a2
pip --disable-pip-version-check install poetry==1.2.0a2
poetry config --local virtualenvs.in-project true
echo '::endgroup::'
Expand All @@ -90,12 +90,8 @@ jobs:
if: ${{ matrix.python-version != '3.10-dev' && env.DEPS_INSTALLED == 'true' }}
run: |
poetry run pflake8 --version
poetry run pflake8 jrnl features tests
poetry run pflake8 jrnl tests
- name: Test with pytest
if: ${{ env.DEPS_INSTALLED == 'true' }}
run: poetry run pytest --junitxml=reports/pytest/results.xml

- name: Test with behave
if: ${{ env.DEPS_INSTALLED == 'true' }}
run: poetry run behave --no-skipped --format progress2 --junit --junit-directory reports/behave
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ A typical development workflow includes:

When resolving bugs or adding new functionality, please add tests to prevent that functionality from breaking in the future. If you notice any functionality that isn't covered in the tests, feel free to submit a test-only pull request as well.

For integration testing, jrnl uses [behave](https://behave.readthedocs.io/) tests, which are all in the `features` folder.
For testing, jrnl uses [pytest](https://docs.pytest.org) for unit tests, and [pytest-bdd](https://pytest-bdd.readthedocs.io/) for integration testing. All tests are in the `tests` folder.

Many tests can be created by only editing `feature` files with the same format as other tests. For more complicated functionality, you may need to implement steps in `features/steps` which are then executed by your tests in the `feature` files.
Many tests can be created by only editing `*.feature` files with the same format as other tests. For more complicated functionality, you may need to implement steps in `tests/lib/` which are then executed by your tests in the `feature` files.

Starting in 2020, jrnl is also using [pytest](https://docs.pytest.org/) for unit tests. These tests are in the `tests` folder.

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ bdd: # bdd tests
bdd-debug: # bdd tests
poetry run pytest tests/bdd --gherkin-terminal-reporter --tb=native -x -vv

test: lint unit bdd ## Run unit tests and behave tests
test: lint unit bdd

build:
poetry build
Expand Down
8 changes: 0 additions & 8 deletions features/build.feature

This file was deleted.

21 changes: 0 additions & 21 deletions features/core.feature

This file was deleted.

17 changes: 0 additions & 17 deletions features/data/configs/basic_dayone.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions features/data/configs/basic_encrypted.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions features/data/configs/basic_folder.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions features/data/configs/basic_onefile.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions features/data/configs/brackets.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions features/data/configs/bug153.yaml

This file was deleted.

13 changes: 0 additions & 13 deletions features/data/configs/bug343.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions features/data/configs/bug780.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions features/data/configs/dayone.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions features/data/configs/dayone_empty.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions features/data/configs/deletion.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions features/data/configs/deletion_filters.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions features/data/configs/editor-args.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions features/data/configs/editor.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions features/data/configs/editor_empty_folder.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions features/data/configs/editor_encrypted.yaml

This file was deleted.

18 changes: 0 additions & 18 deletions features/data/configs/editor_markdown_extension.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions features/data/configs/empty_folder.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions features/data/configs/encrypted.yaml

This file was deleted.

13 changes: 0 additions & 13 deletions features/data/configs/encrypted_old.json

This file was deleted.

11 changes: 0 additions & 11 deletions features/data/configs/encrypted_old.yaml

This file was deleted.

Loading

0 comments on commit 44edb9b

Please sign in to comment.