Skip to content

Commit

Permalink
Test the option --bail
Browse files Browse the repository at this point in the history
  • Loading branch information
Josef-Friedrich committed Jan 26, 2024
1 parent c7b1458 commit 8551cdd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 27 deletions.
12 changes: 12 additions & 0 deletions tests/test_command_line_interface.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
"""Test the command line interface using subprocess."""

from __future__ import annotations

import os

from mscxyz import Score
from tests import helper
from tests.helper import Cli


Expand All @@ -19,3 +21,13 @@ def test_exists(self) -> None:
def test_size(self) -> None:
score: Score = Cli("--backup", "--dry-run").score()
assert os.path.getsize(score.path) == os.path.getsize(score.backup_file)


class TestOptionBail:
def test_no_bail(self) -> None:
assert "XMLSyntaxError" in Cli(helper.get_file("broken.mscx")).stdout()

def test_bail(self) -> None:
assert (
"XMLSyntaxError" in Cli("--bail", helper.get_file("broken.mscx")).sysexit()
)
12 changes: 9 additions & 3 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ def print_elements(element: _Element, level: int) -> None:
print_elements(score.xml_root, 0)


@pytest.mark.skip("Strange error! Fails in tox make test ... but works in vscode and with pytest -k test_set_meta_tag_title")
@pytest.mark.skip(
"Strange error! Fails in tox make test ... but works in vscode and with pytest -k test_set_meta_tag_title"
)
def test_set_meta_tag_composer(score: Score) -> None:
assert score.meta.metatag.composer == "Composer"

Expand All @@ -40,7 +42,9 @@ def test_set_meta_tag_composer(score: Score) -> None:
assert new_score.meta.metatag.composer == "Mozart"


@pytest.mark.skip("Strange error! Fails in tox make test ... but works in vscode and with pytest -k test_set_meta_tag_title")
@pytest.mark.skip(
"Strange error! Fails in tox make test ... but works in vscode and with pytest -k test_set_meta_tag_title"
)
def test_set_all_font_faces_using_for_loop(score: Score) -> None:
assert score.style.get("defaultFontFace") == "FreeSerif"

Expand All @@ -53,7 +57,9 @@ def test_set_all_font_faces_using_for_loop(score: Score) -> None:
assert new_score.style.get("defaultFontFace") == "Alegreya"


@pytest.mark.skip("Strange error! Fails in tox make test ... but works in vscode and with pytest -k test_set_meta_tag_title")
@pytest.mark.skip(
"Strange error! Fails in tox make test ... but works in vscode and with pytest -k test_set_meta_tag_title"
)
def test_set_all_font_faces_using_method(score: Score) -> None:
assert score.style.get("defaultFontFace") == "FreeSerif"

Expand Down
24 changes: 0 additions & 24 deletions tests/test_init.py

This file was deleted.

0 comments on commit 8551cdd

Please sign in to comment.