-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Speed up tests by gently patching
mido
to not do useless work (#44)
- Loading branch information
Showing
4 changed files
with
32 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import pytest | ||
|
||
|
||
@pytest.fixture() | ||
def disable_mido_checks(monkeypatch): | ||
""" | ||
Disable internal checks in `mido`, for performance. | ||
""" | ||
from mido.messages import messages | ||
|
||
monkeypatch.setattr(messages, "check_msgdict", lambda d: d) | ||
|
||
|
||
@pytest.fixture() | ||
def disable_mido_merge_tracks(monkeypatch): | ||
""" | ||
Disallow `mido` from creating `merged_tracks` when files are loaded. | ||
We don't need `merged_tracks` in our tests, and it's slow to create. | ||
See https://github.com/mido/mido/pull/565. | ||
TODO: this could maybe be removed after the | ||
abovementioned PR is in a `mido` release. | ||
""" | ||
from mido.midifiles import midifiles | ||
|
||
monkeypatch.setattr(midifiles, "merge_tracks", lambda tracks: None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters