From 3788a4ba0a18f60630e5d487b68be3fe570952ee Mon Sep 17 00:00:00 2001 From: Eduardo Dobay Date: Sat, 9 May 2020 00:05:19 -0300 Subject: [PATCH] Reorganize test packages and remove custom runners * Custom runners are unneeded with the builtin "unittest discovery" command. * Reorganize test packages and avoid conflicts with the builtin `unittest` module. * Remove unneeded path and suite boilerplate from tests. --- Makefile | 14 +-- tests/__init__.py | 0 {unittest => tests}/example.sf2 | Bin tests/integration/__init__.py | 0 .../integration}/test_fluidsynth.py | 7 +- .../integration}/test_lilypond.py | 4 - tests/unit/__init__.py | 0 tests/unit/containers/__init__.py | 0 .../unit/containers}/test_bar.py | 13 +-- .../unit/containers}/test_composition.py | 11 +-- .../unit/containers}/test_instrument.py | 10 +-- .../unit/containers}/test_note.py | 12 +-- .../unit/containers}/test_note_containers.py | 12 +-- .../unit/containers}/test_suite.py | 11 +-- .../unit/containers}/test_track.py | 13 +-- tests/unit/core/__init__.py | 0 {unittest => tests/unit/core}/test_chords.py | 4 - .../unit/core}/test_intervals.py | 10 +-- {unittest => tests/unit/core}/test_keys.py | 11 +-- {unittest => tests/unit/core}/test_meter.py | 13 +-- {unittest => tests/unit/core}/test_notes.py | 4 - .../unit/core}/test_progressions.py | 4 - {unittest => tests/unit/core}/test_scales.py | 11 +-- {unittest => tests/unit/core}/test_value.py | 4 - .../unit/extra}/440_880_clean.wav | Bin .../unit/extra}/440_sine_clean.wav | Bin tests/unit/extra/__init__.py | 0 {unittest => tests/unit/extra}/test_fft.py | 18 ++-- .../unit/extra}/test_musicxml.py | 9 +- .../unit/extra}/test_tablature.py | 10 +-- .../unit/extra}/test_tunings.py | 10 +-- unittest/run_fluidsynth_tests.py | 31 ------- unittest/run_lilypond_tests.py | 27 ------ unittest/run_tests.py | 84 ------------------ 34 files changed, 55 insertions(+), 302 deletions(-) create mode 100644 tests/__init__.py rename {unittest => tests}/example.sf2 (100%) create mode 100644 tests/integration/__init__.py rename {unittest => tests/integration}/test_fluidsynth.py (97%) rename {unittest => tests/integration}/test_lilypond.py (98%) create mode 100644 tests/unit/__init__.py create mode 100644 tests/unit/containers/__init__.py rename {unittest => tests/unit/containers}/test_bar.py (95%) rename {unittest => tests/unit/containers}/test_composition.py (64%) rename {unittest => tests/unit/containers}/test_instrument.py (93%) rename {unittest => tests/unit/containers}/test_note.py (97%) rename {unittest => tests/unit/containers}/test_note_containers.py (98%) rename {unittest => tests/unit/containers}/test_suite.py (63%) rename {unittest => tests/unit/containers}/test_track.py (80%) create mode 100644 tests/unit/core/__init__.py rename {unittest => tests/unit/core}/test_chords.py (99%) rename {unittest => tests/unit/core}/test_intervals.py (99%) rename {unittest => tests/unit/core}/test_keys.py (92%) rename {unittest => tests/unit/core}/test_meter.py (95%) rename {unittest => tests/unit/core}/test_notes.py (97%) rename {unittest => tests/unit/core}/test_progressions.py (98%) rename {unittest => tests/unit/core}/test_scales.py (99%) rename {unittest => tests/unit/core}/test_value.py (97%) rename {unittest => tests/unit/extra}/440_880_clean.wav (100%) rename {unittest => tests/unit/extra}/440_sine_clean.wav (100%) create mode 100644 tests/unit/extra/__init__.py rename {unittest => tests/unit/extra}/test_fft.py (62%) rename {unittest => tests/unit/extra}/test_musicxml.py (59%) rename {unittest => tests/unit/extra}/test_tablature.py (77%) rename {unittest => tests/unit/extra}/test_tunings.py (96%) delete mode 100755 unittest/run_fluidsynth_tests.py delete mode 100755 unittest/run_lilypond_tests.py delete mode 100755 unittest/run_tests.py diff --git a/Makefile b/Makefile index c4c21c5f..f36b0400 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ PATH := $(project_dir)/venv/bin:$(PATH) all: format: - python -m black mingus mingus_examples unittest + python -m black mingus mingus_examples tests dev: pip install -e '.[fft,fluidsynth]' -r requirements-dev.in @@ -12,14 +12,16 @@ dev: install: pip install . -test: - (cd unittest; python run_tests.py) +test: test-unit + +test-unit: + python -m unittest discover tests.unit test-fluidsynth: - (cd unittest; python run_fluidsynth_tests.py) + python -m unittest tests.integration.test_fluidsynth test-lilypond: - (cd unittest; python run_lilypond_tests.py) + python -m unittest tests.integration.test_lilypond test-all: test test-fluidsynth test-lilypond @@ -47,6 +49,6 @@ release: clean build sign-build upload tag .PHONY: format \ dev install \ - test test-fluidsynth test-lilypond test-all \ + test test-unit test-fluidsynth test-lilypond test-all \ clean build \ upload tag release diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/unittest/example.sf2 b/tests/example.sf2 similarity index 100% rename from unittest/example.sf2 rename to tests/example.sf2 diff --git a/tests/integration/__init__.py b/tests/integration/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/unittest/test_fluidsynth.py b/tests/integration/test_fluidsynth.py similarity index 97% rename from unittest/test_fluidsynth.py rename to tests/integration/test_fluidsynth.py index f7093610..bf16c829 100644 --- a/unittest/test_fluidsynth.py +++ b/tests/integration/test_fluidsynth.py @@ -20,6 +20,9 @@ class test_fluidsynth(unittest.TestCase): Check the :py:mod:`mingus.midi.fluidsynth` module for tips on finding SoundFonts. + + Remember: you need a running fluidsynth server process listening at port + 9800 to pass this test. """ def setUp(self): @@ -191,7 +194,3 @@ def test_composition(self): c + t c + t2 self.assertTrue(fluidsynth.play_Composition(c)) - - -def suite(): - return unittest.TestLoader().loadTestsFromTestCase(test_fluidsynth) diff --git a/unittest/test_lilypond.py b/tests/integration/test_lilypond.py similarity index 98% rename from unittest/test_lilypond.py rename to tests/integration/test_lilypond.py index a7b99ed7..993d7e84 100644 --- a/unittest/test_lilypond.py +++ b/tests/integration/test_lilypond.py @@ -189,7 +189,3 @@ def test_to_png(self): ) self.assertTrue(LilyPond.to_png(LilyPond.from_Bar(self.tbar), "pn2")) self.assertTrue(LilyPond.to_png(LilyPond.from_Bar(self.mbar), "pn3")) - - -def suite(): - return unittest.TestLoader().loadTestsFromTestCase(test_LilyPond) diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/unit/containers/__init__.py b/tests/unit/containers/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/unittest/test_bar.py b/tests/unit/containers/test_bar.py similarity index 95% rename from unittest/test_bar.py rename to tests/unit/containers/test_bar.py index a3d2e5e0..67173342 100644 --- a/unittest/test_bar.py +++ b/tests/unit/containers/test_bar.py @@ -1,15 +1,12 @@ +# -*- coding: utf-8 -*- from __future__ import absolute_import -# -*- coding: utf-8 -*- -import sys +import unittest -sys.path += ["../"] -from mingus.core.keys import Key from mingus.containers.bar import Bar from mingus.containers.note import Note from mingus.containers.note_container import NoteContainer -from mingus.containers.mt_exceptions import MeterFormatError -import unittest +from mingus.core.keys import Key class test_Bar(unittest.TestCase): @@ -121,7 +118,3 @@ def test_determine_progression(self): b + ["C", "E", "G"] b + ["F", "A", "C"] self.assertEqual([[0.0, ["I"]], [0.25, ["IV"]]], b.determine_progression(True)) - - -def suite(): - return unittest.TestLoader().loadTestsFromTestCase(test_Bar) diff --git a/unittest/test_composition.py b/tests/unit/containers/test_composition.py similarity index 64% rename from unittest/test_composition.py rename to tests/unit/containers/test_composition.py index 4228dc7a..9bbc7085 100644 --- a/unittest/test_composition.py +++ b/tests/unit/containers/test_composition.py @@ -1,17 +1,12 @@ +# -*- coding: utf-8 -*- from __future__ import absolute_import -# -*- coding: utf-8 -*- -import sys +import unittest -sys.path += ["../"] +# noinspection PyUnresolvedReferences from mingus.containers.composition import Composition -import unittest class test_Composition(unittest.TestCase): def setUp(self): pass - - -def suite(): - return unittest.TestLoader().loadTestsFromTestCase(test_Composition) diff --git a/unittest/test_instrument.py b/tests/unit/containers/test_instrument.py similarity index 93% rename from unittest/test_instrument.py rename to tests/unit/containers/test_instrument.py index bc972f05..9be94c22 100644 --- a/unittest/test_instrument.py +++ b/tests/unit/containers/test_instrument.py @@ -1,12 +1,10 @@ +# -*- coding: utf-8 -*- from __future__ import absolute_import -# -*- coding: utf-8 -*- -import sys +import unittest -sys.path += ["../"] from mingus.containers.instrument import Instrument, Piano, Guitar from mingus.containers.note_container import NoteContainer -import unittest class test_Instrument(unittest.TestCase): @@ -47,7 +45,3 @@ def test_can_play_notes(self): False, self.g.can_play_notes(NoteContainer(["A", "B", "C", "D", "E", "F", "G",])), ) - - -def suite(): - return unittest.TestLoader().loadTestsFromTestCase(test_Instrument) diff --git a/unittest/test_note.py b/tests/unit/containers/test_note.py similarity index 97% rename from unittest/test_note.py rename to tests/unit/containers/test_note.py index 6009e3e2..5bcef9ba 100644 --- a/unittest/test_note.py +++ b/tests/unit/containers/test_note.py @@ -1,12 +1,10 @@ -from __future__ import absolute_import - # -*- coding: utf-8 -*- -import sys +from __future__ import absolute_import -sys.path += ["../"] -from mingus.containers.note import Note import unittest + from mingus.containers.mt_exceptions import NoteFormatError +from mingus.containers.note import Note class test_Note(unittest.TestCase): @@ -114,7 +112,3 @@ def test_from_shorthand(self): self.assertTrue(Note().from_shorthand("c") == Note("C-3")) self.assertTrue(Note().from_shorthand("c'") == Note("C-4")) self.assertTrue(Note().from_shorthand("c''''''") == Note("C-9")) - - -def suite(): - return unittest.TestLoader().loadTestsFromTestCase(test_Note) diff --git a/unittest/test_note_containers.py b/tests/unit/containers/test_note_containers.py similarity index 98% rename from unittest/test_note_containers.py rename to tests/unit/containers/test_note_containers.py index 4e96b496..6f8f12dc 100644 --- a/unittest/test_note_containers.py +++ b/tests/unit/containers/test_note_containers.py @@ -1,12 +1,10 @@ +# -*- coding: utf-8 -*- from __future__ import absolute_import -# -*- coding: utf-8 -*- -import sys +import unittest -sys.path += ["../"] -from mingus.containers.note_container import NoteContainer from mingus.containers.note import Note -import unittest +from mingus.containers.note_container import NoteContainer class test_NoteContainers(unittest.TestCase): @@ -137,7 +135,3 @@ def test_is_dissonant(self): self.assertTrue(not NoteContainer().from_chord("C").is_dissonant()) self.assertTrue(not NoteContainer().from_chord("G").is_dissonant()) self.assertTrue(not NoteContainer().from_chord("Dm").is_dissonant()) - - -def suite(): - return unittest.TestLoader().loadTestsFromTestCase(test_NoteContainers) diff --git a/unittest/test_suite.py b/tests/unit/containers/test_suite.py similarity index 63% rename from unittest/test_suite.py rename to tests/unit/containers/test_suite.py index bfcce9d9..d652c725 100644 --- a/unittest/test_suite.py +++ b/tests/unit/containers/test_suite.py @@ -1,17 +1,12 @@ +# -*- coding: utf-8 -*- from __future__ import absolute_import -# -*- coding: utf-8 -*- -import sys +import unittest -sys.path += ["../"] +# noinspection PyUnresolvedReferences from mingus.containers.suite import Suite -import unittest class test_Suite(unittest.TestCase): def setUp(self): pass - - -def suite(): - return unittest.TestLoader().loadTestsFromTestCase(test_Suite) diff --git a/unittest/test_track.py b/tests/unit/containers/test_track.py similarity index 80% rename from unittest/test_track.py rename to tests/unit/containers/test_track.py index acd4cce1..c9334463 100644 --- a/unittest/test_track.py +++ b/tests/unit/containers/test_track.py @@ -1,13 +1,10 @@ +# -*- coding: utf-8 -*- from __future__ import absolute_import -# -*- coding: utf-8 -*- -import sys +import unittest -sys.path += ["../"] -from mingus.containers.track import Track -from mingus.containers.bar import Bar from mingus.containers.instrument import Instrument, Piano, Guitar -import unittest +from mingus.containers.track import Track class test_Track(unittest.TestCase): @@ -29,7 +26,3 @@ def test_transpose(self): s + "E" s + "G#" self.assertEqual(s, t) - - -def suite(): - return unittest.TestLoader().loadTestsFromTestCase(test_Track) diff --git a/tests/unit/core/__init__.py b/tests/unit/core/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/unittest/test_chords.py b/tests/unit/core/test_chords.py similarity index 99% rename from unittest/test_chords.py rename to tests/unit/core/test_chords.py index 4f6ad71e..7cb3fdd0 100644 --- a/unittest/test_chords.py +++ b/tests/unit/core/test_chords.py @@ -468,7 +468,3 @@ def test_determine_polychord(self): lambda x: chords.determine_polychords(x, True), "polychord naming", ) - - -def suite(): - return unittest.TestLoader().loadTestsFromTestCase(test_chords) diff --git a/unittest/test_intervals.py b/tests/unit/core/test_intervals.py similarity index 99% rename from unittest/test_intervals.py rename to tests/unit/core/test_intervals.py index 87fdd9a1..14ab92a8 100644 --- a/unittest/test_intervals.py +++ b/tests/unit/core/test_intervals.py @@ -1,11 +1,9 @@ +# -*- coding: utf-8 -*- from __future__ import absolute_import -# -*- coding: utf-8 -*- -import sys +import unittest -sys.path += ["../"] import mingus.core.intervals as intervals -import unittest class test_intervals(unittest.TestCase): @@ -396,7 +394,3 @@ def test_is_dissonant(self): self.assertTrue(intervals.is_dissonant("C", "F#")) self.assertTrue(intervals.is_dissonant("C", "Bb")) self.assertTrue(intervals.is_dissonant("C", "B")) - - -def suite(): - return unittest.TestLoader().loadTestsFromTestCase(test_intervals) diff --git a/unittest/test_keys.py b/tests/unit/core/test_keys.py similarity index 92% rename from unittest/test_keys.py rename to tests/unit/core/test_keys.py index 7a0358ca..7847d7bd 100644 --- a/unittest/test_keys.py +++ b/tests/unit/core/test_keys.py @@ -1,12 +1,9 @@ +# -*- coding: utf-8 -*- from __future__ import absolute_import -# -*- coding: utf-8 -*- -import sys +import unittest -sys.path += ["../"] import mingus.core.keys as keys -from mingus.core.mt_exceptions import NoteFormatError, KeyError -import unittest class test_keys(unittest.TestCase): @@ -71,7 +68,3 @@ def test_relative_minor(self): "The minor of %s is not %s, expecting %s" % (k, keys.relative_minor(k), known[k]), ) - - -def suite(): - return unittest.TestLoader().loadTestsFromTestCase(test_keys) diff --git a/unittest/test_meter.py b/tests/unit/core/test_meter.py similarity index 95% rename from unittest/test_meter.py rename to tests/unit/core/test_meter.py index b2145e44..699bc129 100644 --- a/unittest/test_meter.py +++ b/tests/unit/core/test_meter.py @@ -1,13 +1,12 @@ -from __future__ import absolute_import - # -*- coding: utf-8 -*- -import sys +from __future__ import absolute_import -sys.path += ["../"] -import mingus.core.meter as meter import unittest + from six.moves import range +import mingus.core.meter as meter + class test_meter(unittest.TestCase): def setUp(self): @@ -96,7 +95,3 @@ def test_is_asymmetrical(self): def test_is_full(self): pass - - -def suite(): - return unittest.TestLoader().loadTestsFromTestCase(test_meter) diff --git a/unittest/test_notes.py b/tests/unit/core/test_notes.py similarity index 97% rename from unittest/test_notes.py rename to tests/unit/core/test_notes.py index 05d8073d..7250457b 100644 --- a/unittest/test_notes.py +++ b/tests/unit/core/test_notes.py @@ -108,7 +108,3 @@ def test_diminish(self): "The diminished note of %s is not %s, expecting %s" % (x, notes.diminish(x), known[x]), ) - - -def suite(): - return unittest.TestLoader().loadTestsFromTestCase(test_notes) diff --git a/unittest/test_progressions.py b/tests/unit/core/test_progressions.py similarity index 98% rename from unittest/test_progressions.py rename to tests/unit/core/test_progressions.py index d5ff1f5b..0dd1f518 100644 --- a/unittest/test_progressions.py +++ b/tests/unit/core/test_progressions.py @@ -146,7 +146,3 @@ def test_determine(self): self.assertEqual( ["bii", "bIVM6"], progressions.determine(["Db", "Fb", "Ab"], "C", True) ) - - -def suite(): - return unittest.TestLoader().loadTestsFromTestCase(test_progressions) diff --git a/unittest/test_scales.py b/tests/unit/core/test_scales.py similarity index 99% rename from unittest/test_scales.py rename to tests/unit/core/test_scales.py index 49651f6b..b83671f3 100644 --- a/unittest/test_scales.py +++ b/tests/unit/core/test_scales.py @@ -1,12 +1,9 @@ -from __future__ import absolute_import - # -*- coding: utf-8 -*- +from __future__ import absolute_import -import sys +import unittest -sys.path += ["../"] import mingus.core.scales as scales -import unittest class test_scales(unittest.TestCase): @@ -450,7 +447,3 @@ def test_not_equal(self): self.assertNotEqual(scales.NaturalMinor("A"), scales.MelodicMinor("A")) self.assertNotEqual(scales.Major("F"), scales.Major("D")) self.assertNotEqual(scales.Ionian("E"), scales.Dorian("E")) - - -def suite(): - return unittest.TestLoader().loadTestsFromTestCase(test_scales) diff --git a/unittest/test_value.py b/tests/unit/core/test_value.py similarity index 97% rename from unittest/test_value.py rename to tests/unit/core/test_value.py index 1f97827f..06e59eef 100644 --- a/unittest/test_value.py +++ b/tests/unit/core/test_value.py @@ -84,7 +84,3 @@ def test_septuplet(self): self.assertEqual(value.septuplet(32, False), 28) self.assertEqual(value.septuplet(64, False), 56) self.assertEqual(value.septuplet(128, False), 112) - - -def suite(): - return unittest.TestLoader().loadTestsFromTestCase(test_value) diff --git a/unittest/440_880_clean.wav b/tests/unit/extra/440_880_clean.wav similarity index 100% rename from unittest/440_880_clean.wav rename to tests/unit/extra/440_880_clean.wav diff --git a/unittest/440_sine_clean.wav b/tests/unit/extra/440_sine_clean.wav similarity index 100% rename from unittest/440_sine_clean.wav rename to tests/unit/extra/440_sine_clean.wav diff --git a/tests/unit/extra/__init__.py b/tests/unit/extra/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/unittest/test_fft.py b/tests/unit/extra/test_fft.py similarity index 62% rename from unittest/test_fft.py rename to tests/unit/extra/test_fft.py index 49a108f4..a95a45f9 100644 --- a/unittest/test_fft.py +++ b/tests/unit/extra/test_fft.py @@ -1,17 +1,19 @@ -from __future__ import absolute_import - # -*- coding: utf-8 -*- -import sys +from __future__ import absolute_import -sys.path += ["../"] import unittest + +from pkg_resources import resource_filename + import mingus.extra.fft as fft from mingus.containers import * class test_fft(unittest.TestCase): def setUp(self): - (self.data, self.freq, self.bits) = fft.data_from_file("440_sine_clean.wav") + (self.data, self.freq, self.bits) = fft.data_from_file( + resource_filename(__name__, "440_sine_clean.wav") + ) def test_find_Note(self): self.assertEqual(Note("A"), fft.find_Note(self.data, self.freq, self.bits)) @@ -19,9 +21,5 @@ def test_find_Note(self): def test_find_melody(self): self.assertEqual( [(Note("A-4"), 86), (Note("A-5"), 86)], - fft.find_melody("440_880_clean.wav", 512)[:2], + fft.find_melody(resource_filename(__name__, "440_880_clean.wav"), 512)[:2], ) - - -def suite(): - return unittest.TestLoader().loadTestsFromTestCase(test_fft) diff --git a/unittest/test_musicxml.py b/tests/unit/extra/test_musicxml.py similarity index 59% rename from unittest/test_musicxml.py rename to tests/unit/extra/test_musicxml.py index a128e19e..95483d50 100644 --- a/unittest/test_musicxml.py +++ b/tests/unit/extra/test_musicxml.py @@ -1,16 +1,11 @@ from __future__ import absolute_import -import sys -sys.path += ["../"] +import unittest +# noinspection PyUnresolvedReferences import mingus.extra.musicxml as mxl -import unittest class test_MusicXML(unittest.TestCase): def setUp(self): pass - - -def suite(): - return unittest.TestLoader().loadTestsFromTestCase(test_MusicXML) diff --git a/unittest/test_tablature.py b/tests/unit/extra/test_tablature.py similarity index 77% rename from unittest/test_tablature.py rename to tests/unit/extra/test_tablature.py index 0e80b7ad..d0111300 100644 --- a/unittest/test_tablature.py +++ b/tests/unit/extra/test_tablature.py @@ -1,12 +1,10 @@ +# -*- coding: utf-8 -*- from __future__ import absolute_import -# -*- coding: utf-8 -*- -import sys +import unittest -sys.path += ["../"] import mingus.extra.tablature as tablature import mingus.extra.tunings as tunings -import unittest class test_Tablature(unittest.TestCase): @@ -15,7 +13,3 @@ def setUp(self): def test__get_qsize(self): self.assertTrue(tablature._get_qsize(self.guitar, 4) == 0) - - -def suite(): - return unittest.TestLoader().loadTestsFromTestCase(test_Tablature) diff --git a/unittest/test_tunings.py b/tests/unit/extra/test_tunings.py similarity index 96% rename from unittest/test_tunings.py rename to tests/unit/extra/test_tunings.py index a90fa5a9..e4655776 100644 --- a/unittest/test_tunings.py +++ b/tests/unit/extra/test_tunings.py @@ -1,13 +1,11 @@ +# -*- coding: utf-8 -*- from __future__ import absolute_import -# -*- coding: utf-8 -*- -import sys +import unittest -sys.path += ["../"] import mingus.extra.tunings as tunings from mingus.containers.note import Note from mingus.core.mt_exceptions import RangeError -import unittest class test_Tunings(unittest.TestCase): @@ -84,7 +82,3 @@ def test_get_Note(self): self.assertRaises(RangeError, self.guitar6.get_Note, 7, 3) self.assertRaises(RangeError, self.guitar6.get_Note, 3, -1) self.assertRaises(RangeError, self.guitar6.get_Note, 3, 25) - - -def suite(): - return unittest.TestLoader().loadTestsFromTestCase(test_Tunings) diff --git a/unittest/run_fluidsynth_tests.py b/unittest/run_fluidsynth_tests.py deleted file mode 100755 index 1b4555be..00000000 --- a/unittest/run_fluidsynth_tests.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# mingus - Music theory Python package, run_fluidsynth_tests module. -# Copyright (C) 2008, Bart Spaans -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -"""Separated fluidsynth tests. - -Remember: you need a running fluidsynth server process listening at port -9800 to pass this test. -""" -from __future__ import absolute_import - -import unittest -import test_fluidsynth - -suite = unittest.TestSuite([test_fluidsynth.suite()]) -unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/unittest/run_lilypond_tests.py b/unittest/run_lilypond_tests.py deleted file mode 100755 index 3409d234..00000000 --- a/unittest/run_lilypond_tests.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# mingus - Music theory Python package, run_lilypond_tests module. -# Copyright (C) 2008, Bart Spaans -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -"""Separated LilyPond tests.""" -from __future__ import absolute_import - -import unittest -import test_lilypond - -suite = unittest.TestSuite([test_lilypond.suite()]) -unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/unittest/run_tests.py b/unittest/run_tests.py deleted file mode 100755 index 58bb9870..00000000 --- a/unittest/run_tests.py +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# mingus - Music theory Python package, run_tests module. -# Copyright (C) 2008, Bart Spaans -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -"""Test suite for the music theory package. - -Invoke this file from the command line, from within the 'unittest' directory -to run all the testcases. -""" -from __future__ import absolute_import - -import unittest - -import test_notes -import test_keys -import test_intervals -import test_chords -import test_scales -import test_meter -import test_progressions -import test_value - -# mingus.containers Tests - -import test_note -import test_note_containers -import test_instrument -import test_bar -import test_track -import test_composition -import test_suite - -# MIDI TESTS HERE ... - -import test_fft -import test_tablature -import test_tunings -import test_musicxml - -# See run_fluidsynth_tests.py for FluidSynth audio tests See -# run_lilypond_tests.py to generate some pdf's -# -# Add new suites here... - -core = [ - test_notes, - test_keys, - test_intervals, - test_chords, - test_scales, - test_meter, - test_progressions, - test_value, -] -containers = [ - test_note, - test_note_containers, - test_instrument, - test_bar, - test_track, - test_composition, - test_suite, -] -extra = [test_fft, test_tunings, test_tablature, test_musicxml] - -# Run all tests - -suite = unittest.TestSuite([x.suite() for x in core + containers + extra]) -unittest.TextTestRunner(verbosity=2).run(suite)