Skip to content

Commit

Permalink
Improve testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Josef-Friedrich committed Dec 31, 2023
1 parent 092b0f2 commit e862e78
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,8 @@
},
"python.defaultInterpreterPath": ".venv/bin/python",
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": [
"--rootdir", "${workspaceFolder}/tests",
]
}
3 changes: 2 additions & 1 deletion mscxyz/score_file_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
MscoreLyricsInterface
"""

from __future__ import annotations

import fnmatch
import os
Expand All @@ -33,7 +34,7 @@

def list_scores(
path: str, extension: str = "both", glob: Optional[str] = None
) -> List[str]:
) -> list[str]:
"""List all scores in path.
:param path: The path so search for score files.
Expand Down
8 changes: 7 additions & 1 deletion tests/test_score_file_classes.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
"""Test submodules “score_file_classes.py”"""


from __future__ import annotations

import filecmp
import os
import pathlib
import shutil
from typing import Optional
from unittest import mock

import pytest
Expand All @@ -22,7 +26,9 @@

class TestFunctions:
@staticmethod
def _list_scores(path, extension="both", glob=None):
def _list_scores(
path: str, extension: str = "both", glob: Optional[str] = None
) -> list[str]:
with mock.patch("os.walk") as mockwalk:
mockwalk.return_value = [
("/a", ("bar",), ("lorem.mscx",)),
Expand Down

0 comments on commit e862e78

Please sign in to comment.