Commit graph

237 commits

Author SHA1 Message Date
Adrian Sampson
5a3157d85d Try to make a test more reliable
As @arcresu pointed out on Gitter, this openSUSE patch adds a safeguard
to this test, which was apparently failing for them:
https://build.opensuse.org/package/view_file/openSUSE:Factory/beets/fix_test_command_line_option_relative_to_working_dir.diff?expand=1

Reading the configuration once here to make sure that we're in a clean
state seems harmless enough. The culprit is likely that a previous test
was modifying the configuration and not properly cleaning up. This
change defends against that kind of mistake.
2019-06-02 20:16:51 -04:00
Carl Suster
d2f13bf65c confit: replace with confuse in tests 2019-06-01 10:13:13 +10:00
Carl Suster
546bf3af7e mediafile: import from standalone module 2019-05-29 09:35:14 +10:00
Carl Suster
bed89df69a Fix test_ui:test_version under pytest
The test `CommonOptionsParserCliTest.test_version` was passing with nose
but failing with pytest (see output below). The reason for the failure
seemed to be that the `test` plugin was loaded when it wasn't expected
to be loaded, changing the output of the `version` command. I'm not sur
exactly why that was happening, but since that test already inherited
from `TestHelper`, just invoking the plugin load/unload helper was
enough to fix it. I also removed the line setting the `self.lib`
variable since that's already done in the helper.

---

self = <test.test_ui.CommonOptionsParserCliTest testMethod=test_version>

    def test_version(self):
        l = self.run_with_output(u'version')
        self.assertIn(u'Python version', l)
>       self.assertIn(u'no plugins loaded', l)
E       AssertionError: 'no plugins loaded' not found in 'beets version 1.4.8\nPython version 3.7.3rc1\nplugins: test\n'

test/test_ui.py:1292: AssertionError
2019-03-31 20:22:44 +11:00
jroitgrund@gmail.com
ea307f62d1 Don't move album art twice 2019-03-27 01:41:42 +00:00
Adrian Sampson
dc45119a8d Avoid comparing patterns in a test
As pointed out here:
https://github.com/beetbox/beets/pull/3028#issuecomment-420257867
2018-09-16 20:52:31 -04:00
zigarrre
b376139663 Refactored move functions for clarity according to #2682
The move functions in library.py and manipule_files in importer.py where
changed to use a single parameter for the file operation instead of
multiple boolean flags.

A typo in the documentation of the Album.move and Item.move functions
confusing True and False when describing the store parameter was fixed
as well.
2017-09-11 17:03:44 +02:00
Adrian Sampson
ca4f96e33c Consolidate export tests into MoveTest
Just one new flag.
2017-06-10 20:26:41 -04:00
Adrian Sampson
730c84e5e5 Correct tests for export mode
The old tests were wrong but the incorrectness was hidden by the incorrect
parameter passing fixed in the previous commit. Now we actually test that the
item's path did not change.
2017-06-10 20:25:48 -04:00
Adrian Sampson
714560aace Fix parameter order and binding
The calls didn't match up with the parameter order.
2017-06-10 20:19:27 -04:00
Adrian Sampson
b25eb87f60 Remove unnecessary output capture 2017-06-10 20:05:17 -04:00
Adrian Sampson
29d6c27d02 Fix some spurious whitespace changes 2017-06-10 20:03:01 -04:00
SpirosChadoulos
8f62e8bc68 Requested changes done 2017-05-12 14:49:03 +03:00
SpirosChadoulos
c4ef23d9f7 Minor Flake fixes 2017-05-11 12:45:03 +03:00
SpirosChadoulos
51835e762f Minor fixes to move tests 2017-05-11 12:30:21 +03:00
SpirosChadoulos
0dc948d9d3 Made sure that the destination directory will exist 2017-05-11 12:11:21 +03:00
SpirosChadoulos
f5b23fffd4 Replaced all AssertNotExists with AssertExists 2017-05-06 15:03:42 +03:00
SpirosChadoulos
a88192240e ExportTest correction 2017-04-30 15:14:17 +03:00
SpirosChadoulos
bab99f546f Added a test for the new export feature 2017-04-30 15:02:50 +03:00
Adrian Sampson
7c6eafa285 Refactor manual search options to use Proposal
This is the first step to making them behave like plugin actions.
2016-12-28 13:50:53 -05:00
Adrian Sampson
ae5e55cad6 Always use syspath to construct MediaFile
Related to #1966. Previously, we used a `syspath` call inside MediaFile, which
probably wasn't right: the constructor should behave like `open` in that we
need to use pass an OS path.
2016-12-04 21:00:56 -05:00
Adrian Sampson
a88682e7bb Undo from _common import unittest indirection
This was a vestige from when we used to need the unittest2 library for pre-2.7
compatibility. Now that we require Python 2.7, we aren't using that library
and this indirection wasn't doing any good.
2016-11-26 18:46:44 -05:00
Adrian Sampson
d54ef99ea5 Fix a forgotten test 2016-11-25 21:33:44 -05:00
Dang Mai
04560bd88e Stop passing in fields to be stored for Item.move and Album.move 2016-10-23 15:52:27 -04:00
Dang Mai
f42f558db2 Fix long line for flake8 2016-10-20 21:21:50 -04:00
Dang Mai
406f3ce843 Add tests and make sure they pass 2016-10-20 21:07:12 -04:00
Dang Mai
679918f191 Fix some test failures 2016-10-20 00:28:28 -04:00
Johnny Robeson
49fc2ac5e9 Use run_with_command in write_cmd in test_ui.py 2016-09-18 03:31:00 -04:00
Johnny Robeson
da0e15b71e fold capture_stdout into _run_list() in test_ui 2016-09-09 18:55:47 -04:00
Johnny Robeson
7a2bdf502f s/utf8/utf-8/ in all encoding/decoding contexts
This matches up with the python documentation.
2016-09-06 23:10:24 -04:00
Johnny Robeson
304df82361 rename/move ui._arg_encoding to util.arg_encoding
We use this for more than ui concerns, so it should be in util.

It is also no longer marked as a "private" method.
2016-08-04 17:16:11 -04:00
Johnny Robeson
15a8409535 add python version to beet --version 2016-07-31 02:48:07 -04:00
Adrian Sampson
6772b4d1fd Leave captured stdout as Unicode on Python 3 2016-07-25 13:24:51 -04:00
Adrian Sampson
0e2b8a5b60 Use native strings for IO in a test 2016-07-25 13:22:57 -04:00
Adrian Sampson
b73bbf0b3e In completion tests, don't load system scripts
On my machine, the "leak" of other bash_completion scripts here recently
started doing a *lot* of work for other packages. Most damningly, it started
compiling a bunch of stuff with rustc! Now we only load beets' own completion
stuff.
2016-07-25 12:57:44 -04:00
Adrian Sampson
e65e7a6716 Fix minor style in completion test 2016-07-25 12:45:32 -04:00
Johnny Robeson
ba26b7d26f replace calls to _raw_main in test_ui with run_command 2016-07-25 01:04:06 -04:00
Johnny Robeson
20321feda7 read and write pipes as bytes in completion tests
The stdin/stdout for subprocess are bytes, so treat them that way
2016-07-23 04:34:07 -04:00
Johnny Robeson
0377a4e26b open completion files in test_ui in binary mode 2016-07-23 04:24:15 -04:00
Jesse Weinstein
8474ae3f66 Fix patcher to always be correctly cleaned up 2016-07-21 23:55:07 -07:00
Johnny Robeson
bb15829b17 add missing b' to config.yaml files in ui tests
I'd not gotten around to doing this because of other py3 test
issues, but here we go now!
2016-07-07 03:44:19 -04:00
Johnny Robeson
35d0e81949 add missing bytestring_paths for python -bb 2016-07-03 22:25:47 -04:00
Johnny Robeson
9020dc1f45 use text_string() in a few places for io output 2016-07-02 00:03:46 -04:00
Johnny Robeson
aa0a0a0f22 use util.py3_path for confit and env paths in tests 2016-06-30 22:24:17 -04:00
Johnny Robeson
dd729f0ce8 mark more paths as bytestrings in tests 2016-06-30 22:21:56 -04:00
Adrian Sampson
c532860613 Apply simple type consistency changes from #2096
These are the changes from that PR that just enforce the path type invariants
we already want---they're a good idea regardless of Python 3.
2016-06-30 14:22:16 -07:00
Adrian Sampson
d5205915cc Avoid dangerous string conversions (#2094)
This rolls back the places in #2094 where `six.text_type(s)` was used where
`s` might be a bytestring. We almost never want that conversion, because it
uses the default encoding (almost always ASCII). The need for it indicates a
problem somewhere else, where bytes were produced when we were expecting
unicode strings.
2016-06-29 10:30:26 -07:00
Adrian Sampson
5efd5b21c5 Use new as_str method
Instead of `get(six.text_type)`, which was a surprisingly large portion of our
uses of six.
2016-06-25 19:16:14 -07:00
Johnny Robeson
e8afcbe7ec replace unicode with six.text_type 2016-06-24 05:53:49 -04:00
Adrian Sampson
133c82b1ab Fix #2063: properly decode format CLI argument 2016-06-21 15:15:24 -07:00