Skip to content

Commit

Permalink
Use pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
Josef-Friedrich committed Dec 30, 2023
1 parent 0133ab6 commit 361e1c3
Show file tree
Hide file tree
Showing 16 changed files with 100 additions and 115 deletions.
11 changes: 2 additions & 9 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,6 @@
"**/.tex/": true
},
"python.defaultInterpreterPath": ".venv/bin/python",
"python.testing.unittestArgs": [
"-v",
"-s",
"./tests",
"-p",
"test_*.py"
],
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": true,
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
37 changes: 18 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
all: test

build:
rm -rf dist
python3 setup.py sdist

doc:
python setup.py build_sphinx
test:
poetry run tox

install:
python setup.py install
poetry install

develop:
python setup.py develop
install_editable:
pip install -e .

upload:
pip3 install twine
twine upload --skip-existing dist/*
update:
poetry lock
poetry install

readme:
./_generate-readme.py
build:
poetry build

test:
tox
publish:
poetry build
poetry publish

docs:
poetry run tox -e docs
xdg-open docs/_build/index.html

.PHONY: all build doc install develop upload readme test
.PHONY: test install install_editable update build publish docs
47 changes: 16 additions & 31 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,12 @@ mscxyz

.. code-block:: text
usage: mscx-manager [-h] [-V] [-b] [-c] [-C GENERAL_CONFIG_FILE] [-d] [-g GENERAL_GLOB] [-m] [-e GENERAL_EXECUTABLE] [-v]
{clean,meta,lyrics,rename,export,help} ... path
usage: mscx-manager [-h] [-V] [-b] [-c] [-C GENERAL_CONFIG_FILE] [-d] [-g GENERAL_GLOB] [-m] [-e GENERAL_EXECUTABLE] [-v] {clean,meta,lyrics,rename,export,help} ... path
A command line tool to manipulate the XML based "*.mscX" and "*.mscZ" files of the notation software MuseScore.
positional arguments:
path Path to a "*.mscx" file or a folder which contains "*.mscx" files. In conjunction with the subcommand "help"
this positional parameter accepts the names of all other subcommands or the word "all".
path Path to a "*.mscx" file or a folder which contains "*.mscx" files. In conjunction with the subcommand "help" this positional parameter accepts the names of all other subcommands or the word "all".
options:
-h, --help show this help message and exit
Expand All @@ -62,27 +60,22 @@ mscxyz
Specify a configuration file in the INI format.
-d, --dry-run Simulate the actions.
-g GENERAL_GLOB, --glob GENERAL_GLOB
Handle only files which matches against Unix style glob patterns (e. g. "*.mscx", "* - *"). If you omit this
option, the standard glob pattern "*.msc[xz]" is used.
-m, --mscore Open and save the XML file in MuseScore after manipulating the XML with lxml to avoid differences in the XML
structure.
Handle only files which matches against Unix style glob patterns (e. g. "*.mscx", "* - *"). If you omit this option, the standard glob pattern "*.msc[xz]" is used.
-m, --mscore Open and save the XML file in MuseScore after manipulating the XML with lxml to avoid differences in the XML structure.
-e GENERAL_EXECUTABLE, --executable GENERAL_EXECUTABLE
Path of the musescore executable.
-v, --verbose Make commands more verbose. You can specifiy multiple arguments (. g.: -vvv) to make the command more
verbose.
-v, --verbose Make commands more verbose. You can specifiy multiple arguments (. g.: -vvv) to make the command more verbose.
Subcommands:
{clean,meta,lyrics,rename,export,help}
Run "subcommand --help" for more informations.
clean Clean and reset the formating of the "*.mscx" file
meta Deal with meta data informations stored in the MuseScore file.
lyrics Extract lyrics. Without any option this subcommand extracts all lyrics verses into separate mscx files. This
generated mscx files contain only one verse. The old verse number is appended to the file name, e. g.:
lyrics Extract lyrics. Without any option this subcommand extracts all lyrics verses into separate mscx files. This generated mscx files contain only one verse. The old verse number is appended to the file name, e. g.:
score_1.mscx.
rename Rename the "*.mscx" files.
export Export the scores to PDFs or to the specified extension.
help Show help. Use “mscx-manager help all” to show help messages of all subcommands. Use “mscx-manager help
<subcommand>” to show only help messages for the given subcommand.
help Show help. Use “mscx-manager help all” to show help messages of all subcommands. Use “mscx-manager help <subcommand>” to show only help messages for the given subcommand.
Subcommands
===========
Expand All @@ -104,8 +97,7 @@ mscx-manager meta

.. code-block:: text
usage: mscx-manager meta [-h] [-c META_CLEAN] [-D] [-d SOURCE_FIELDS FORMAT_STRING] [-j] [-l DESTINATION FORMAT_STRING] [-s]
[-S DESTINATION_FIELD FORMAT_STRING]
usage: mscx-manager meta [-h] [-c META_CLEAN] [-D] [-d SOURCE_FIELDS FORMAT_STRING] [-j] [-l DESTINATION FORMAT_STRING] [-s] [-S DESTINATION_FIELD FORMAT_STRING]
MuseScore can store meta data informations in different places:
Expand Down Expand Up @@ -186,18 +178,14 @@ mscx-manager meta
-c META_CLEAN, --clean META_CLEAN
Clean the meta data fields. Possible values: „all“ or „field_one,field_two“.
-D, --delete-duplicates
Deletes combined_lyricist if this field is equal to combined_composer. Deletes combined_subtitle if this
field is equal tocombined_title. Move combined_subtitle to combimed_title if combined_title is empty.
Deletes combined_lyricist if this field is equal to combined_composer. Deletes combined_subtitle if this field is equal tocombined_title. Move combined_subtitle to combimed_title if combined_title is empty.
-d SOURCE_FIELDS FORMAT_STRING, --distribute-fields SOURCE_FIELDS FORMAT_STRING
Distribute source fields to target fields applying a format string on the source fields. It is possible to
apply multiple --distribute-fields options. SOURCE_FIELDS can be a single field or a comma separated list of
fields: field_one,field_two. The program tries first to match the FORMAT_STRING on the first source field.
If this fails, it tries the second source field ... an so on.
Distribute source fields to target fields applying a format string on the source fields. It is possible to apply multiple --distribute-fields options. SOURCE_FIELDS can be a single field or a comma separated list
of fields: field_one,field_two. The program tries first to match the FORMAT_STRING on the first source field. If this fails, it tries the second source field ... an so on.
-j, --json Additionally write the meta data to a json file.
-l DESTINATION FORMAT_STRING, --log DESTINATION FORMAT_STRING
Write one line per file to a text file. e. g. --log /tmp/mscx-manager.log '$title $composer'
-s, --synchronize Synchronize the values of the first vertical frame (vbox) (title, subtitle, composer, lyricist) with the
corresponding metadata fields
-s, --synchronize Synchronize the values of the first vertical frame (vbox) (title, subtitle, composer, lyricist) with the corresponding metadata fields
-S DESTINATION_FIELD FORMAT_STRING, --set-field DESTINATION_FIELD FORMAT_STRING
Set value to meta data fields.
Expand All @@ -213,9 +201,8 @@ mscx-manager lyrics
-e LYRICS_EXTRACT, --extract LYRICS_EXTRACT
The lyric verse number to extract or "all".
-r LYRICS_REMAP, --remap LYRICS_REMAP
Remap lyrics. Example: "--remap 3:2,5:3". This example remaps lyrics verse 3 to verse 2 and verse 5 to 3.
Use commas to specify multiple remap pairs. One remap pair is separated by a colon in this form: "old:new":
"old" stands for the old verse number. "new" stands for the new verse number.
Remap lyrics. Example: "--remap 3:2,5:3". This example remaps lyrics verse 3 to verse 2 and verse 5 to 3. Use commas to specify multiple remap pairs. One remap pair is separated by a colon in this form:
"old:new": "old" stands for the old verse number. "new" stands for the new verse number.
-f, --fix Fix lyrics: Convert trailing hyphens ("la- la- la") to a correct hyphenation ("la - la - la")
mscx-manager rename
Expand Down Expand Up @@ -449,10 +436,8 @@ mscx-manager help
options:
-h, --help show this help message and exit
-m, --markdown Show help in markdown format. This option enables to generate the README file directly form the command line
output.
-r, --rst Show help in reStructuresText format. This option enables to generate the README file directly form the command
line output.
-m, --markdown Show help in markdown format. This option enables to generate the README file directly form the command line output.
-r, --rst Show help in reStructuresText format. This option enables to generate the README file directly form the command line output.
API Usage
=========
Expand Down
47 changes: 16 additions & 31 deletions doc/source/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ mscxyz

.. code-block:: text
usage: mscx-manager [-h] [-V] [-b] [-c] [-C GENERAL_CONFIG_FILE] [-d] [-g GENERAL_GLOB] [-m] [-e GENERAL_EXECUTABLE] [-v]
{clean,meta,lyrics,rename,export,help} ... path
usage: mscx-manager [-h] [-V] [-b] [-c] [-C GENERAL_CONFIG_FILE] [-d] [-g GENERAL_GLOB] [-m] [-e GENERAL_EXECUTABLE] [-v] {clean,meta,lyrics,rename,export,help} ... path
A command line tool to manipulate the XML based "*.mscX" and "*.mscZ" files of the notation software MuseScore.
positional arguments:
path Path to a "*.mscx" file or a folder which contains "*.mscx" files. In conjunction with the subcommand "help"
this positional parameter accepts the names of all other subcommands or the word "all".
path Path to a "*.mscx" file or a folder which contains "*.mscx" files. In conjunction with the subcommand "help" this positional parameter accepts the names of all other subcommands or the word "all".
options:
-h, --help show this help message and exit
Expand All @@ -25,27 +23,22 @@ mscxyz
Specify a configuration file in the INI format.
-d, --dry-run Simulate the actions.
-g GENERAL_GLOB, --glob GENERAL_GLOB
Handle only files which matches against Unix style glob patterns (e. g. "*.mscx", "* - *"). If you omit this
option, the standard glob pattern "*.msc[xz]" is used.
-m, --mscore Open and save the XML file in MuseScore after manipulating the XML with lxml to avoid differences in the XML
structure.
Handle only files which matches against Unix style glob patterns (e. g. "*.mscx", "* - *"). If you omit this option, the standard glob pattern "*.msc[xz]" is used.
-m, --mscore Open and save the XML file in MuseScore after manipulating the XML with lxml to avoid differences in the XML structure.
-e GENERAL_EXECUTABLE, --executable GENERAL_EXECUTABLE
Path of the musescore executable.
-v, --verbose Make commands more verbose. You can specifiy multiple arguments (. g.: -vvv) to make the command more
verbose.
-v, --verbose Make commands more verbose. You can specifiy multiple arguments (. g.: -vvv) to make the command more verbose.
Subcommands:
{clean,meta,lyrics,rename,export,help}
Run "subcommand --help" for more informations.
clean Clean and reset the formating of the "*.mscx" file
meta Deal with meta data informations stored in the MuseScore file.
lyrics Extract lyrics. Without any option this subcommand extracts all lyrics verses into separate mscx files. This
generated mscx files contain only one verse. The old verse number is appended to the file name, e. g.:
lyrics Extract lyrics. Without any option this subcommand extracts all lyrics verses into separate mscx files. This generated mscx files contain only one verse. The old verse number is appended to the file name, e. g.:
score_1.mscx.
rename Rename the "*.mscx" files.
export Export the scores to PDFs or to the specified extension.
help Show help. Use “mscx-manager help all” to show help messages of all subcommands. Use “mscx-manager help
<subcommand>” to show only help messages for the given subcommand.
help Show help. Use “mscx-manager help all” to show help messages of all subcommands. Use “mscx-manager help <subcommand>” to show only help messages for the given subcommand.
Subcommands
===========
Expand All @@ -67,8 +60,7 @@ mscx-manager meta

.. code-block:: text
usage: mscx-manager meta [-h] [-c META_CLEAN] [-D] [-d SOURCE_FIELDS FORMAT_STRING] [-j] [-l DESTINATION FORMAT_STRING] [-s]
[-S DESTINATION_FIELD FORMAT_STRING]
usage: mscx-manager meta [-h] [-c META_CLEAN] [-D] [-d SOURCE_FIELDS FORMAT_STRING] [-j] [-l DESTINATION FORMAT_STRING] [-s] [-S DESTINATION_FIELD FORMAT_STRING]
MuseScore can store meta data informations in different places:
Expand Down Expand Up @@ -149,18 +141,14 @@ mscx-manager meta
-c META_CLEAN, --clean META_CLEAN
Clean the meta data fields. Possible values: „all“ or „field_one,field_two“.
-D, --delete-duplicates
Deletes combined_lyricist if this field is equal to combined_composer. Deletes combined_subtitle if this
field is equal tocombined_title. Move combined_subtitle to combimed_title if combined_title is empty.
Deletes combined_lyricist if this field is equal to combined_composer. Deletes combined_subtitle if this field is equal tocombined_title. Move combined_subtitle to combimed_title if combined_title is empty.
-d SOURCE_FIELDS FORMAT_STRING, --distribute-fields SOURCE_FIELDS FORMAT_STRING
Distribute source fields to target fields applying a format string on the source fields. It is possible to
apply multiple --distribute-fields options. SOURCE_FIELDS can be a single field or a comma separated list of
fields: field_one,field_two. The program tries first to match the FORMAT_STRING on the first source field.
If this fails, it tries the second source field ... an so on.
Distribute source fields to target fields applying a format string on the source fields. It is possible to apply multiple --distribute-fields options. SOURCE_FIELDS can be a single field or a comma separated list
of fields: field_one,field_two. The program tries first to match the FORMAT_STRING on the first source field. If this fails, it tries the second source field ... an so on.
-j, --json Additionally write the meta data to a json file.
-l DESTINATION FORMAT_STRING, --log DESTINATION FORMAT_STRING
Write one line per file to a text file. e. g. --log /tmp/mscx-manager.log '$title $composer'
-s, --synchronize Synchronize the values of the first vertical frame (vbox) (title, subtitle, composer, lyricist) with the
corresponding metadata fields
-s, --synchronize Synchronize the values of the first vertical frame (vbox) (title, subtitle, composer, lyricist) with the corresponding metadata fields
-S DESTINATION_FIELD FORMAT_STRING, --set-field DESTINATION_FIELD FORMAT_STRING
Set value to meta data fields.
Expand All @@ -176,9 +164,8 @@ mscx-manager lyrics
-e LYRICS_EXTRACT, --extract LYRICS_EXTRACT
The lyric verse number to extract or "all".
-r LYRICS_REMAP, --remap LYRICS_REMAP
Remap lyrics. Example: "--remap 3:2,5:3". This example remaps lyrics verse 3 to verse 2 and verse 5 to 3.
Use commas to specify multiple remap pairs. One remap pair is separated by a colon in this form: "old:new":
"old" stands for the old verse number. "new" stands for the new verse number.
Remap lyrics. Example: "--remap 3:2,5:3". This example remaps lyrics verse 3 to verse 2 and verse 5 to 3. Use commas to specify multiple remap pairs. One remap pair is separated by a colon in this form:
"old:new": "old" stands for the old verse number. "new" stands for the new verse number.
-f, --fix Fix lyrics: Convert trailing hyphens ("la- la- la") to a correct hyphenation ("la - la - la")
mscx-manager rename
Expand Down Expand Up @@ -412,7 +399,5 @@ mscx-manager help
options:
-h, --help show this help message and exit
-m, --markdown Show help in markdown format. This option enables to generate the README file directly form the command line
output.
-r, --rst Show help in reStructuresText format. This option enables to generate the README file directly form the command
line output.
-m, --markdown Show help in markdown format. This option enables to generate the README file directly form the command line output.
-r, --rst Show help in reStructuresText format. This option enables to generate the README file directly form the command line output.
Loading

0 comments on commit 361e1c3

Please sign in to comment.