From a844148a4ec872ea544499c57d52915da11bfe1e Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Thu, 11 Feb 2016 15:23:09 +0100 Subject: [PATCH] Use splitext to allow arbitrarw extensions --- patacrep/songbook/__init__.py | 2 +- test/test_songbook/test_compilation.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/patacrep/songbook/__init__.py b/patacrep/songbook/__init__.py index 34c77eb5..fa6b8047 100644 --- a/patacrep/songbook/__init__.py +++ b/patacrep/songbook/__init__.py @@ -38,7 +38,7 @@ def open_songbook(filename): songbook = _add_songbook_defaults(user_songbook) songbook['_filepath'] = filename - songbook['_basename'] = os.path.basename(filename)[:-len(".yaml")] + songbook['_basename'] = os.path.splitext(os.path.basename(filename))[0] # Gathering datadirs songbook['_datadir'] = list(_iter_absolute_datadirs(songbook)) diff --git a/test/test_songbook/test_compilation.py b/test/test_songbook/test_compilation.py index 09a3e382..71c4ac26 100644 --- a/test/test_songbook/test_compilation.py +++ b/test/test_songbook/test_compilation.py @@ -36,7 +36,7 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): os.path.dirname(__file__), '*.yaml', ))): - base = songbook[:-len(".yaml")] + base = os.path.splitext(songbook)[0] yield ( "test_latex_generation_{}".format(os.path.basename(base)), cls._create_generation_test(base),