-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mbsubmit: cleanup and completion #1779
Changes from 2 commits
8746869
966746f
798dd72
418ad58
85ad17d
53ecec1
9bba782
75636a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# -*- coding: utf-8 -*- | ||
# This file is part of beets. | ||
# Copyright 2015, Adrian Sampson and Diego Moreda. | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining | ||
# a copy of this software and associated documentation files (the | ||
# "Software"), to deal in the Software without restriction, including | ||
# without limitation the rights to use, copy, modify, merge, publish, | ||
# distribute, sublicense, and/or sell copies of the Software, and to | ||
# permit persons to whom the Software is furnished to do so, subject to | ||
# the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be | ||
# included in all copies or substantial portions of the Software. | ||
|
||
from __future__ import (division, absolute_import, print_function, | ||
unicode_literals) | ||
|
||
from test._common import unittest | ||
from test.helper import capture_stdout, control_stdin, TestHelper | ||
from test.test_importer import ImportHelper, AutotagStub | ||
from test.test_ui_importer import TerminalImportSessionSetup | ||
|
||
|
||
class MBSubmitPluginTest(TerminalImportSessionSetup, unittest.TestCase, | ||
ImportHelper, TestHelper): | ||
def setUp(self): | ||
self.setup_beets() | ||
self.load_plugins('mbsubmit') | ||
self._create_import_dir(2) | ||
self._setup_import_session() | ||
self.matcher = AutotagStub().install() | ||
|
||
def tearDown(self): | ||
self.unload_plugins() | ||
self.teardown_beets() | ||
|
||
def test_xxxxprint_tracks_output(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, there is a powerful reason: my sometimes absent mind! 🔨 On a more serious note, I did notice just after submitting the pull request and already fixed it on my local copy. The current code was still meant to have a final cleanup phase on my end, that will also address the issue with the "non-full sentence" comments - sorry about that. |
||
"""Test the output of the "print tracks" choice.""" | ||
self.matcher.matching = AutotagStub.BAD | ||
|
||
with capture_stdout() as output: | ||
with control_stdin('\n'.join(['p', 's'])): | ||
# Print tracks; Skip | ||
self.importer.run() | ||
|
||
# manually build the string for comparing the output | ||
tracklist = ('Print tracks? ' | ||
'01. Tag Title 1 - Tag Artist (0:01)\n' | ||
'02. Tag Title 2 - Tag Artist (0:01)') | ||
self.assertIn(tracklist, output.getvalue()) | ||
|
||
def test_xxprint_tracks_output_as_tracks(self): | ||
"""Test the output of the "print tracks" choice, as singletons.""" | ||
self.matcher.matching = AutotagStub.BAD | ||
|
||
with capture_stdout() as output: | ||
with control_stdin('\n'.join(['t', 's', 'p', 's'])): | ||
# as Tracks; Skip; Print tracks; Skip | ||
self.importer.run() | ||
|
||
# manually build the string for comparing the output | ||
tracklist = ('Print tracks? ' | ||
'02. Tag Title 2 - Tag Artist (0:01)') | ||
self.assertIn(tracklist, output.getvalue()) | ||
|
||
|
||
def suite(): | ||
return unittest.TestLoader().loadTestsFromName(__name__) | ||
|
||
if __name__ == b'__main__': | ||
unittest.main(defaultTest='suite') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We tend to format comments as "full sentences" in beets—starting with a capital letter and ending with a period.