[tests] dynamically determine jrnl version for plugin tests

This commit is contained in:
MinchinWeb 2021-05-09 17:05:58 -06:00
parent 432681f8a3
commit 5a341cf13f
3 changed files with 44 additions and 39 deletions

View file

@ -51,7 +51,7 @@ jobs:
poetry config --local virtualenvs.in-project true poetry config --local virtualenvs.in-project true
poetry install --remove-untracked poetry install --remove-untracked
poetry install poetry install
poetry run python -m pip install -e "git+${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git@${GITHUB_SHA}#egg=jrnl-demo-plugins&subdirectory=tests/external_plugins_src" poetry run python -m pip install "git+${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git@${GITHUB_SHA}#egg=jrnl-demo-plugins&subdirectory=tests/external_plugins_src"
- name: Test with pytest - name: Test with pytest
if: success() || failure() if: success() || failure()

View file

@ -10,21 +10,21 @@ Feature: Functionality of Importer and Exporter Plugins
Examples: Examples:
| plugin_name | version | source | type | filename | | plugin_name | version | source | type | filename |
| jrnl | v2.8.1 | plugins | importer | jrnl | | jrnl | <pyproject.toml version> | plugins | importer | jrnl |
| boxed | v2.8.1 | plugins | exporter | fancy | | boxed | <pyproject.toml version> | plugins | exporter | fancy |
| dates | v2.8.1 | plugins | exporter | dates | | dates | <pyproject.toml version> | plugins | exporter | dates |
| default | v2.8.1 | plugins | exporter | pretty | | default | <pyproject.toml version> | plugins | exporter | pretty |
| fancy | v2.8.1 | plugins | exporter | fancy | | fancy | <pyproject.toml version> | plugins | exporter | fancy |
| json | v2.8.1 | plugins | exporter | json | | json | <pyproject.toml version> | plugins | exporter | json |
| markdown | v2.8.1 | plugins | exporter | markdown | | markdown | <pyproject.toml version> | plugins | exporter | markdown |
| md | v2.8.1 | plugins | exporter | markdown | | md | <pyproject.toml version> | plugins | exporter | markdown |
| pretty | v2.8.1 | plugins | exporter | pretty | | pretty | <pyproject.toml version> | plugins | exporter | pretty |
| short | v2.8.1 | plugins | exporter | short | | short | <pyproject.toml version> | plugins | exporter | short |
| tags | v2.8.1 | plugins | exporter | tag | | tags | <pyproject.toml version> | plugins | exporter | tag |
| text | v2.8.1 | plugins | exporter | text | | text | <pyproject.toml version> | plugins | exporter | text |
| txt | v2.8.1 | plugins | exporter | text | | txt | <pyproject.toml version> | plugins | exporter | text |
| xml | v2.8.1 | plugins | exporter | xml | | xml | <pyproject.toml version> | plugins | exporter | xml |
| yaml | v2.8.1 | plugins | exporter | yaml | | yaml | <pyproject.toml version> | plugins | exporter | yaml |
@skip_only_with_external_plugins @skip_only_with_external_plugins
Scenario Outline: List external plugin names in --version Scenario Outline: List external plugin names in --version
@ -34,24 +34,24 @@ Feature: Functionality of Importer and Exporter Plugins
And The output should contain "<plugin_name> : <version> from jrnl.<source>.<type>.<filename>" And The output should contain "<plugin_name> : <version> from jrnl.<source>.<type>.<filename>"
Examples: Examples:
| plugin_name | version | source | type | filename | | plugin_name | version | source | type | filename |
| jrnl | v2.8.1 | plugins | importer | jrnl | | jrnl | <pyproject.toml version> | plugins | importer | jrnl |
| json | v1.0.0 | contrib | importer | json | | json | v1.0.0 | contrib | importer | json |
| boxed | v2.8.1 | plugins | exporter | fancy | | boxed | <pyproject.toml version> | plugins | exporter | fancy |
| dates | v2.8.1 | plugins | exporter | dates | | dates | <pyproject.toml version> | plugins | exporter | dates |
| default | v2.8.1 | plugins | exporter | pretty | | default | <pyproject.toml version> | plugins | exporter | pretty |
| fancy | v2.8.1 | plugins | exporter | fancy | | fancy | <pyproject.toml version> | plugins | exporter | fancy |
| json | v1.0.0 | contrib | exporter | json | | json | v1.0.0 | contrib | exporter | json |
| markdown | v2.8.1 | plugins | exporter | markdown | | markdown | <pyproject.toml version> | plugins | exporter | markdown |
| md | v2.8.1 | plugins | exporter | markdown | | md | <pyproject.toml version> | plugins | exporter | markdown |
| pretty | v2.8.1 | plugins | exporter | pretty | | pretty | <pyproject.toml version> | plugins | exporter | pretty |
| rot13 | v1.0.0 | contrib | exporter | rot13 | | rot13 | v1.0.0 | contrib | exporter | rot13 |
| short | v2.8.1 | plugins | exporter | short | | short | <pyproject.toml version> | plugins | exporter | short |
| tags | v2.8.1 | plugins | exporter | tag | | tags | <pyproject.toml version> | plugins | exporter | tag |
| testing | v0.0.1 | contrib | exporter | testing | | testing | v0.0.1 | contrib | exporter | testing |
| text | v2.8.1 | plugins | exporter | text | | text | <pyproject.toml version> | plugins | exporter | text |
| txt | v1.0.0 | contrib | exporter | rot13 | | txt | v1.0.0 | contrib | exporter | rot13 |
| xml | v2.8.1 | plugins | exporter | xml | | xml | <pyproject.toml version> | plugins | exporter | xml |
| yaml | v2.8.1 | plugins | exporter | yaml | | yaml | <pyproject.toml version> | plugins | exporter | yaml |
@skip_only_with_external_plugins @skip_only_with_external_plugins
Scenario Outline: Do not list overridden plugin names in --version Scenario Outline: Do not list overridden plugin names in --version
@ -62,5 +62,5 @@ Feature: Functionality of Importer and Exporter Plugins
Examples: Examples:
| plugin_name | version | source | type | filename | | plugin_name | version | source | type | filename |
| json | v2.8.1 | plugins | exporter | json | | json | <pyproject.toml version> | plugins | exporter | json |
| txt | v2.8.1 | plugins | exporter | text | | txt | <pyproject.toml version> | plugins | exporter | text |

View file

@ -540,6 +540,11 @@ def check_output_version_inline(context):
@then('the output should contain "{text}" or "{text2}"') @then('the output should contain "{text}" or "{text2}"')
def check_output_inline(context, text=None, text2=None): def check_output_inline(context, text=None, text2=None):
text = text or context.text text = text or context.text
if "<pyproject.toml version>" in text:
pyproject = (Path(__file__) / ".." / ".." / ".." / "pyproject.toml").resolve()
pyproject_contents = toml.load(pyproject)
pyproject_version = pyproject_contents["tool"]["poetry"]["version"]
text = text.replace("<pyproject.toml version>", pyproject_version)
out = context.stdout_capture.getvalue() out = context.stdout_capture.getvalue()
assert (text and text in out) or (text2 and text2 in out) assert (text and text in out) or (text2 and text2 in out)