Implement @skip_win and @skip_editor

Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
This commit is contained in:
Micah Jerome Ellison 2021-04-19 21:12:37 -07:00 committed by Jonathan Wren
parent 36dc01bf30
commit ce64d7973b
2 changed files with 20 additions and 2 deletions

View file

@ -116,7 +116,7 @@ Feature: Custom formats
| basic_folder.yaml |
| basic_dayone.yaml |
@skip # .TODO return after editor steps implemented
@skip_editor # .TODO return after editor steps implemented
Scenario Outline: Increasing Headings on Markdown export
Given we use the config "<config_file>"
And we use the password "test" if prompted
@ -214,7 +214,7 @@ Feature: Custom formats
| basic_folder.yaml |
# | basic_dayone.yaml | @todo
@skip # .TODO return after editor steps implemented
@skip_editor # .TODO return after editor steps implemented
Scenario Outline: Add a blank line to Markdown export if there isn't one already
# https://github.com/jrnl-org/jrnl/issues/768
# https://github.com/jrnl-org/jrnl/issues/881

View file

@ -22,12 +22,14 @@ from pytest_bdd import when
from pytest_bdd.parsers import parse
from pytest_bdd import parsers
from pytest import fixture
from pytest import mark
import toml
from jrnl import __version__
from jrnl.cli import cli
from jrnl.config import load_config
from jrnl.os_compat import split_args
from jrnl.os_compat import on_windows
class TestKeyring(backend.KeyringBackend):
@ -79,6 +81,22 @@ class FailedKeyring(backend.KeyringBackend):
raise errors.KeyringError
# ----- MARKERS ----- #
def pytest_bdd_apply_tag(tag, function):
if tag == "skip_win":
marker = mark.skipif(on_windows, reason="Skip test on Windows")
elif tag == "skip_editor":
marker = mark.skip(
reason="Skipping editor-related test. We should come back to this!"
)
else:
# Fall back to pytest-bdd's default behavior
return None
marker(function)
return True
# ----- UTILS ----- #
def failed_msg(msg, expected, actual):
return f"{msg}\nExpected:\n{expected}\n---end---\nActual:\n{actual}\n---end---\n"