From ce64d7973bf7a7e09b3d61593fe392f763b6cbca Mon Sep 17 00:00:00 2001 From: Micah Jerome Ellison Date: Mon, 19 Apr 2021 21:12:37 -0700 Subject: [PATCH] Implement @skip_win and @skip_editor Co-authored-by: Jonathan Wren --- tests/features/format.feature | 4 ++-- tests/step_defs/conftest.py | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/features/format.feature b/tests/features/format.feature index ef126a5b..648b4dd0 100644 --- a/tests/features/format.feature +++ b/tests/features/format.feature @@ -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 "" 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 diff --git a/tests/step_defs/conftest.py b/tests/step_defs/conftest.py index 7a651093..7e10883e 100644 --- a/tests/step_defs/conftest.py +++ b/tests/step_defs/conftest.py @@ -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"