Commit graph

2338 commits

Author SHA1 Message Date
Adam Jakab
ceb901fcca struggling with old python 2020-03-15 19:30:24 +01:00
Adam Jakab
935768d983 fixing repr tests 2020-03-15 19:19:09 +01:00
Adam Jakab
8e68b5ff2e cleaning up 2020-03-15 15:54:01 +01:00
Adam Jakab
532c6d7c82 better repr testing #2 2020-03-15 15:41:32 +01:00
Adam Jakab
3f2f125b09 better repr testing 2020-03-15 15:24:17 +01:00
Adam Jakab
d6538e5f0c removed value_match method - not reachable? 2020-03-15 14:57:02 +01:00
Adam Jakab
d5a52cbd26 removed unused imports 2020-03-14 21:51:46 +01:00
Adam Jakab
fbd1266bc5 simplified condition in test and added changelog entry 2020-03-14 21:30:22 +01:00
Adam Jakab
832c7326af corrected test to account for year and disctotal field now being treated as types.INTEGER 2020-03-02 13:03:18 +01:00
Adam Jakab
5fc4d7c35e - added field_two as type STRING in ModelFixture1
- renamed test test_format_fixed_field to test_format_fixed_field_string
- test_format_fixed_field_string not tests `field_two` with string values
- added new test_format_fixed_field_integer to test field `field_one` as INTEGER
- added new test_format_fixed_field_integer_normalized to test rounding float values
2020-03-02 13:00:15 +01:00
ybnd
63ea17365a Modify patched stdout in test_malformed_output 2020-02-05 09:04:24 +01:00
ybnd
c3817a4c06 Implement review comments
* safer version comparison

* regex bytes directly

* handle b'\x08 ...' case

* test_replaygain.py: injected command output should match the type of the actual output
2020-01-30 19:21:53 +01:00
ybnd
c1cb78c908 Small fixes in replaygain.Bs1770gainBackend and test_replaygain.py
* Fix unspecified `gain_adjustment` when method defined in config

* Fix difference between dB and LUFS values in case of mismatched `target_level`/`method`:

  ```
  db_to_lufs( target_level <dB> ) - lufs_to_dB( -23 <LUFS> )
  ```

* Ignore single assertion in case of bs1770gain

(cherry picked from commit 2395bf224032c44f1ea5d28e0c63af96a92b96df)
2020-01-30 17:59:57 +01:00
ybnd
c78afb1a97 Don't call bs1770gain outside of try statement 2020-01-30 17:02:28 +01:00
ybnd
53820c0a98 Handle bs1770gain v0.6.0 XML output
* Remove `0%\x08\x08` from output (backspace code doesn't resolve; progress percentages get spliced in)

* Handle changed attributes/fields:
  * `sample-peak` attribute `factor` is called `amplitude` instead
  * Album summary is not included in a `summary` tag now, but in two separate `integrated` and `sample-peak` tags

* Handle `lu` attribute

* Get bs1770gain version
  * If v0.6.0 or later, add `--unit=ebu` flag to convert `db` attributes to LUFS
  * May be useful later on

### Output examples

Track:
```
<!-- analyzing ... -->
<bs1770gain norm="-18.00">
  <track total="1" number="1" file="02 tïtle 0.mp3">
    <integrated lufs="-70.00" lu="52.00"/>
    <sample-peak spfs="-72.28" amplitude="0.00"/>
  </track>
  <integrated lufs="-70.00" lu="52.00"/>
  <sample-peak spfs="-72.28" amplitude="0.00"/>
</bs1770gain>
<!-- done. -->
```

Album:
```
<!-- analyzing ... -->
<bs1770gain norm="-18.00">
  <track total="2" number="1" file="02 tïtle 0.mp3">
    <integrated dbfs="-70.00" db="52.00"/>
    <sample-peak dbfs="-72.28" amplitude="0.00"/>
  </track>
  <track total="2" number="2" file="02 tïtle 1.mp3">
    <integrated dbfs="-70.00" db="52.00"/>
    <sample-peak dbfs="-72.28" amplitude="0.00"/>
  </track>
  <integrated dbfs="-70.00" db="52.00"/>
  <sample-peak dbfs="-72.28" amplitude="0.00"/>
</bs1770gain>
<!-- done. -->
```
2020-01-30 16:13:29 +01:00
Régis Behmo
b489f94b0d Replace the clinical "obsessive-compulsive" term
This is a follow-up on that conversation on gitter:
https://gitter.im/beetbox/beets?at=5d75ac34b3e2fc579379fe25
2019-11-02 23:26:14 +01:00
Adrian Sampson
a7671e16a6 Merge pull request #3409 from jackwilsdon/hook-check-call
hook: switch to using check_call
2019-10-17 11:12:06 -04:00
Jack Wilsdon
cf7a04ea36
Add tests for hook errors 2019-10-17 11:08:18 +01:00
Austin Marino
c1b646ff27
Merge branch 'master' into Extended_Export_Plugin_Support 2019-10-15 15:35:42 -07:00
Austin Marino
623f553c92 Updated Test structure 2019-10-15 11:51:45 -07:00
Austin Marino
21d809180e Updated Test structure 2019-10-15 11:45:38 -07:00
Austin Marino
07138f86dc Fixed styling and test to pass cli 2019-10-14 18:41:06 -07:00
Austin Marino
a9440ada2b Updated test structure for export 2019-10-14 18:17:12 -07:00
Austin Marino
0d818eced5 Ran test to ensure it works 2019-10-14 17:02:39 -07:00
Austin Marino
db5d21620b Updated tests 2019-10-14 13:57:32 -07:00
Austin Marino
fa2c9ba259 Aligned export related code with flake8 standards 2019-10-13 11:36:33 -07:00
Austin Marino
8ff875bded Addec Unit test for export plugin 2019-10-10 19:34:57 -07:00
Rahul Ahuja
f14137fcc2 Add BPSyncPlugin 2019-10-03 18:04:12 -07:00
temrix
486cfa1df1
Add tests for empty responses. 2019-09-21 16:54:47 +02:00
temrix
2691781d4e
Remove forgotten print statement. 2019-09-21 16:41:57 +02:00
temrix
dde905f9a8
Correct typo in docstring. 2019-09-21 16:41:16 +02:00
temrix
6c8535088a
Add test file. 2019-09-19 00:32:52 +02:00
Zsin Skri
e3645dfd59
Merge branch 'master' into r128-targetlevel-config 2019-07-25 23:22:32 +02:00
Adrian Sampson
84032e56e2 Merge pull request #3334 from MartyLake/martylake_add_forward_slash_option
Add option to force forward slashes in paths
2019-07-24 22:11:59 -04:00
MartyLake
fb96660171 Review: simpler implementation and test
Because **all** the path are bytestrings
2019-07-24 18:09:54 +02:00
Paul Malcolm
5f9a394ca9 Issue #2860 Fetch more acousticbrainz fields 2019-07-23 20:25:26 -04:00
MartyLake
076a82daa6 Review: Rename method 2019-07-24 00:09:52 +02:00
MartyLake
68ccfe0e6c Review: Add missing blank line 2019-07-23 23:54:54 +02:00
MartyLake
d1ba309f36 Add a new method that copied pathlib.path.as_posix 2019-07-23 17:17:40 +02:00
Zsin Skri
88ab5474c5 replaygain: add R128_* tag test
Assert that the replaygain plugin does not write REPLAYGAIN_* tags but R128_*
tags, when instructed to do so.

This test is skipped for the `command` backend as it does not support OPUS.
2019-07-22 13:42:26 +02:00
Zsin Skri
5a8bdb67f7 replaygain: add target_level test
Assert that analysing the same track with different target levels yields
different gain adjustments.
2019-07-22 13:42:26 +02:00
Zsin Skri
b9063a0240 fix bs1770gain test
This test caused other tests to fail due to missing cleanup.
2019-07-22 12:49:50 +02:00
Adrian Sampson
bd6a5cfd8e
Merge pull request #3056 from zsinskri/replaygain-backend-ffmpeg
Replaygain backend ffmpeg
2019-07-20 21:40:43 -04:00
Adrian Sampson
8b4d03095f parentwork tests: Remove unnecessary mocking
This mocking doesn't do anything because `command_output` is never
invoked by the code under test. See also #3332.
2019-07-20 16:23:03 -04:00
Zsin Skri
c3af5b3763 replaygain: add ffmpeg backend
Add replaygain backend using ffmpeg's ebur128 filter.

The album gain is calculated as the mean of all BS.1770 gating block powers.
Besides differences in gating block offset, this should be equivalent to a
BS.1770 analysis of a proper concatenation of all tracks.

Just calculating the mean of all track gains (as implemented by the bs1770gain
backend) yields incorrect results as that would:
- completely ignore track lengths
  - just using length in seconds won't work either (e.g. BS.1770 ignores
    passages below a threshold)
- take the mean of track loudness, not power

When using the ffmpeg replaygain backend to create R128_*_GAIN tags, the
targetlevel will be set to -23 LUFS. GitHub PullRequest #3065 will make this
configurable.
It will also skip peak calculation, as there is no R128_*_PEAK tag.

It is checked if the libavfilter library supports replaygain calculation. Before
version 6.67.100 that did require the `--enable-libebur128` compile-time-option,
after that the ebur128 library is included in libavfilter itself. Thus we
require either a recent enough libavfilter version or the `--enable-libebur128`
option.
2019-07-19 21:54:47 +02:00
Zsin Skri
088af4d171 bpd tests: skip control_port in queue
When setting up bpd tests, two servers are startet: first a control server, then
bpd. Both send their assigned ports down a queue. The recipient only needs bpd's
port and thus skips the first queue entry.
2019-07-17 19:05:51 +02:00
Zsin Skri
8ba79117d9 bpd tests: use mp.Queue to communicate assigned port
Use a `multiprocessing.Queue` instead of a `multiprocessing.Value` to avoid the
manual polling/timeout handling.

TODO: Strangely Listener seems to be constructed twice. Only the second one is
used. Fix that and then remove the code working around it.
2019-07-17 16:19:17 +02:00
Zsin Skri
871f79c8f2 bpd tests: close only existing sockets
Close sockets in `finally`-clauses only after they have actually been created.
2019-07-17 13:38:57 +02:00
Zsin Skri
fb07a5112a bpd tests: terminate server upon connection failure 2019-07-17 13:21:25 +02:00
Zsin Skri
bbda292145 bpd test: make start_server a freestanding function
Under some circumstances (maybe under MS Windows?) local objects can't be
pickled. When `start_server` is a local this causes a crash:
https://ci.appveyor.com/project/beetbox/beets/builds/25996163/job/rbp3frnkwsvbuwx6#L541

Make `start_server` a freestanding function to mitigate this.
2019-07-15 22:25:48 +02:00
Zsin Skri
0ebab5edaa fix "Sporadic test failures in BPD tests #3309"
The bpd test bind a socket in order to test the protocol implementation. When
running concurrently this often resulted in an attempt to bind an already
occupied port.

By using the port number `0` we instead let the OS choose a free port. We then
have to extract it from the socket (which is handled by `bluelet`) via
`mock.patch`ing.
2019-07-15 21:25:39 +02:00
Zsin Skri
30395911e2 util.command_output: return stderr, too
Return a namedtuple CommandOutput(stdout, stderr) instead of just stdout from
util.command_ouput, allowing separate access to stdout and stderr.

This change is required by the ffmpeg replaygain backend (GitHub
PullRequest #3056) as ffmpeg's ebur128 filter outputs only to stderr.
2019-07-14 18:32:59 +02:00
Adrian Sampson
e39341b282 Merge pull request #3322 from thedevilisinthedetails/master
465 discogs: Fetch a few more metadata fields
2019-07-01 17:22:50 -04:00
Peter
0cd46dab77 fixing per review comments 2019-07-01 21:04:35 +02:00
Peter
8bf9d75f66 fixing test 2019-06-30 12:50:36 +02:00
Peter
0e2e2dfec3 adding additional discogs attrributes 2019-06-30 12:22:22 +02:00
Peter
e9dd226b93 fixing test 2019-06-30 12:06:38 +02:00
Adrian Sampson
ed30a7aed2 Merge pull request #3251 from thedevilisinthedetails/master
#2579 Adding styles to discogs plugin
2019-06-10 13:26:09 -04:00
Peter
f0c91b8f45 fixing per review comments 2019-06-09 20:01:55 +02:00
Peter
5fc21a1e21 fixing per review comments 2019-06-09 15:39:49 +02:00
Peter
77dcd63254 adding line 2019-06-09 12:59:32 +02:00
Peter
9789c465aa removing blank line 2019-06-09 12:49:04 +02:00
Peter
371d978e13 removing blank line and making line shorter 2019-06-09 12:39:21 +02:00
Peter
6cdd1ab6c1 fixing test 2019-06-09 12:08:07 +02:00
Peter
851c413976 adding config option for seperator and addressing review comments 2019-06-09 10:37:33 +02:00
Adrian Sampson
c2fdf04539 Merge pull request #3279 from dosoe/beets_parentwork_3
add parentwork plugin
2019-06-08 21:35:05 -04:00
FichteFoll
c144141e9a
Update a few more http URLs to https that I missed
Should really be all now (pending the next commit).
2019-06-05 23:07:11 +02:00
Dorian Soergel
8363dedaeb logging and minor comments 2019-06-05 11:10:11 +02:00
FichteFoll
aa31fea037
Update a lot of URLs to use HTTPS
*All* URLs were checked manually, but only once per domain!

I mostly concerned myself with URLs in documentation rather than source
code because the latter may or may not have impactful changes, while the
former should be straight forward.

Changes in addition to simply adding an s:

- changed pip and pypi references as their location has changed
- MPoD (iOS app) url redirects to Regelian, so I replaced those
- updated homebrew references

Notable observations:

- beets.io does have HTTPS set up properly (via gh-pages)
- beatport.py uses the old HTTP url for beatport
- as does lyrics.py for lyrics.wikia.com
- https://tomahawk-player.org/ expired long ago, but the http page
  redirects to https regardless
- none of the sourceforge subdomains have https (in 2019!)
2019-06-05 03:11:49 +02:00
FichteFoll
dfc23e8efe
Implement database and model revision checking
Prevents reloading a model from the database when it hasn't changed.

Now we're back to almost the same speed as before the addition of album
field fallbacks.
2019-06-05 02:58:42 +02:00
FichteFoll
72515448ad
Add fallback for item access to album's attributes
Allows queries (especially for pathspecs) based on an album's flexattrs
while operating on items.

Fixes #2797.
2019-06-05 02:38:46 +02:00
Dorian Soergel
a71c381bb5 rename functions in test 2019-06-03 20:33:49 +02:00
Dorian Soergel
b3b59f8452 rename functions in test 2019-06-03 20:14:43 +02:00
Carl Suster
be1daa9771
Merge pull request #3214 from arcresu/bpd-mpd16
bpd: support MPD 0.16 protocol and more clients
2019-06-03 10:39:35 +10:00
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
62aa358ce7 bpd: bump protocol version to 0.16 2019-06-02 23:37:07 +10:00
Carl Suster
d8be83bc0d bpd: support ranges in playlistid 2019-06-02 23:37:07 +10:00
Carl Suster
dc7e3b9b6a bpd: support nextsong in status 2019-06-02 23:37:07 +10:00
Carl Suster
fdd809fd36 bpd: support more tagtypes 2019-06-02 23:37:07 +10:00
Carl Suster
27c462d287 bpd: make noidle a no-op outside idle mode
The real MPD ignores `noidle` when the client is not idle. It doesn't
even send a successful response, just ignores the command. Although
I don't understand why a client would fail to keep track of its own
state, it seems that this is necessary to get ncmpcpp working.
2019-06-02 23:37:07 +10:00
Carl Suster
1a5263b68f bpd: support volume command for real 2019-06-02 23:37:07 +10:00
Carl Suster
5c37a58ad6 bpd: add more tests 2019-06-02 23:37:07 +10:00
Carl Suster
59c506990a bpd: fix bug in playlistid
The playlistid command is supposed to list the whole playlist if no
argument is provided, but we were accidentally trying to look up an
impossible negative id in that case causing an error to always be
returned.
2019-06-02 23:37:07 +10:00
Carl Suster
10d41a1cbb tests: avoid non-test classes named Test*
When using pytest's test collector, any class with a name starting with
Test is collected. If it notices that the class has an `__init__` member
then it skips it with a warning since it's probably a false positive.
This isn't a big deal, but we can avoid warnings like this:

    test/test_ui_importer.py:33
      beets/test/test_ui_importer.py:33: PytestCollectionWarning: cannot collect test class 'TestTerminalImportSession' because it has a __init__ constructor
        class TestTerminalImportSession(TerminalImportSession):

simply by renaming TestX to XFixture.
2019-06-02 16:35:37 +10:00
Carl Suster
d2f13bf65c confit: replace with confuse in tests 2019-06-01 10:13:13 +10:00
Dorian Soergel
acf447b4b0 adapt tests, correct docstrings 2019-05-31 17:52:39 +02:00
Dorian Soergel
080680c950 add parentwork plugin, first try 2019-05-31 14:35:51 +02:00
Adrian Sampson
4fc9e2686b
Merge pull request #3277 from beetbox/arcresu-patch-3
Setup path correctly in testall.py
2019-05-30 21:51:14 -04:00
Jack Wilsdon
bc95253566 Setup path correctly in testall.py
By comparing `sys.path` as setup by nose vs. testall.py it seems that we
weren't adding the top-level beets directory to the path. The script was
also previously changing the working directory before running the tests.
2019-05-31 11:28:55 +10:00
Adrian Sampson
a31294f302 Merge pull request #3272 from dosoe/beets_work_id_2
add work, work-disambig and work_id tags
2019-05-30 20:55:24 -04:00
Adrian Sampson
c82072aa80 Merge pull request #3237 from arcresu/mediafile
mediafile: replace with a re-export of beetbox/mediafile
2019-05-30 20:23:17 -04:00
Adrian Sampson
99778d9ece bpd tests: Randomize port number
This is a hacky but effective way to work around a problem when running
the tests in parallel where two different test executions want to use
the same port.
2019-05-30 12:02:47 -04:00
Carl Suster
66e6359812
Make test_random work with setup.py test
Without this change `python setup.py test` fails to run, since this test was missing a `suite`.
2019-05-30 12:59:16 +10:00
Carl Suster
546bf3af7e mediafile: import from standalone module 2019-05-29 09:35:14 +10:00
Carl Suster
8f6e5ede1a mediafile: remove tests 2019-05-29 09:35:14 +10:00
Dorian Soergel
f0d96dcadd replace work_id by mb_workid 2019-05-27 11:59:11 +02:00
Dorian Soergel
7ebcda0c3f revert changes to mediafile 2019-05-27 10:04:54 +02:00
Dorian Soergel
4c197e6f19 completed library and test files 2019-05-26 00:38:38 +02:00
Adrian Sampson
8bef21a4d5 More permissive log check for #3247 2019-05-02 09:38:11 -04:00
Jack Wilsdon
f09088df43
replaygain: Handle invalid XML output from bs1770gain 2019-05-02 01:24:19 +01:00
Carl Suster
063e4f259b
Merge pull request #3222 from arcresu/bpd-decoders
bpd: support decoders command
2019-04-21 09:20:42 +10:00
Louis Sautier
4d98088cc1
Replace more instances of unsafe calls to yaml.load 2019-04-20 01:14:15 +02:00
Carl Suster
3da23167ca bpd: support decoders command
This uses GStreamer APIs to extract a list of audio decoders and the
relevant MIME types and file extensions. Some clients like ncmpcpp use
this command to fetch a list of supported file extensions.
2019-04-19 16:08:05 +10:00
Carl Suster
9182f18e6f bpd: support short form of list command for albums
Some clients list the albums belonging to an artist by issuing the
command `list album <ARTIST NAME>`. This change inserts the tag `artist`
before the artist name so that this succeeds. Fixes #3007
2019-04-15 13:25:02 +10:00
Carl Suster
d55f061f0b bpd: add control socket
A new `ControlConnection` is created each time a client connects over
a new control socket. This is used to forward events from the player,
and also for debugging utilities that are not part of the real MPD
protocol.

This new feature reuses as much infrastructure from the normal protocol
handling as possible (e.g. `Command` for parsing messages). While the
normal connection delegates to server `cmd_*` methods which are string
generators, the control connections delegate to `ctrl_*` methods defined
on the connection itself that are full coroutines.
2019-04-09 12:19:15 +10:00
Carl Suster
6fbf3853f2 bpd: bump protocol version to 0.14.0 2019-04-08 11:40:24 +10:00
Carl Suster
d05ca2c2b0 bpd: add tests for idle command 2019-04-08 11:40:24 +10:00
Carl Suster
ee0c31ba6a bpd: track and log client session details
Keep track of a list of currently-connected clients.

Use `socket.getpeername()` to get an identifier for each connection and
include this in each log message. This function is documented as not
being available on all systems, but it's unclear which systems this
involves.

Also log a message on client connect and disconnect events. If the
disconnection reason is because the client sent a blank line, match MPD
by returning a protocol error then hanging up. Escape curly braces.
2019-04-08 11:28:56 +10:00
Carl Suster
5b0a02eb31 bpd: don't send volume if zero in status 2019-04-08 10:52:15 +10:00
Adrian Sampson
362722c87c
Merge pull request #3206 from arcresu/random-util
random: move functionality into beets.random
2019-04-07 11:59:39 -04:00
Carl Suster
9147fabb97 random: beets.util.random -> beets.random 2019-04-07 18:46:11 +10:00
Carl Suster
4158bdb95e mpdstats: update tests for currentsong 2019-04-06 15:31:03 +11:00
Carl Suster
9056467fdc random: allow custom random generator 2019-04-06 12:12:52 +11:00
Carl Suster
438009ba94 random: add test for equal_chance_permutation 2019-04-06 12:10:27 +11:00
Carl Suster
4be2e1b5e6 Remove beets.util.inspect wrapper 2019-04-02 10:22:47 +11:00
Carl Suster
e839e4ea19 bpd: improve exception handling
Check function signature instead of using TypeError to crudely guess
that the wrong number of arguments were provided.

Prevent bpd from crashing when trying to log a traceback. The
`traceback.format_exc` function takes an optional argument which is
supposed to be an integer restricting the length of the backtrace to
show. Instead we were passing the exception object to this function and
causing a new exception to be raised.
2019-04-02 09:39:07 +11:00
Carl Suster
146c5f5e13 bpd: fix repeat, consume and single in reverse
These flags are all relevant to the 'previous' command as well as the
'next' command.
2019-04-01 18:05:10 +11:00
Carl Suster
12e49b3c88 bpd: skipping backwards through zero keeps playing
Previously issuing the 'previous' command when at position 0 on the
playlist would cause bpd to stop playing. MPD instead just restarts the
currently playing song instead, so we now match this behaviour.
2019-04-01 17:51:21 +11:00
Carl Suster
a4fe6875a1 bpd: fix bug in bounds check of current song index
The songs are indexed starting from zero for the play command, however
the bound check was off by one. An index matching the length of the
playlist would crash the server instead of responding with an error
message over the protocol.
2019-04-01 17:41:25 +11:00
Carl Suster
0c3a63ef9f bpd: fix repeat mode behaviour
The repeat flag indicates that the entire playlist should be repeated.
If both the repeat and single flags are set then this triggers the old
behaviour of looping over a single track.
2019-04-01 17:39:35 +11:00
Carl Suster
b245c0e755 bpd: test fields returned by status command 2019-04-01 16:42:39 +11:00
Carl Suster
bae9c40600 bpd: support the single command
This command instructs bpd to stop playing when the current song
finishes. In the MPD 0.20 protocol this flag gains a value 'oneshot' but
for now we just support its older version with a boolean value.
2019-04-01 16:30:02 +11:00
Carl Suster
71e7621642 bpd: no-op support for persistent playlists
The real MPD offers persistent playlist manipulation, storing the
playlists in a directory set in the config file. If that directory is
not available then the feature is disabled and the relevant commands all
respond with errors. Based on this, the initial support in bpd just
returns errors matching the MPD server in the disabled mode.

For playlistadd, extend the _bpd_add helper to work with playlists other
than the queue in order to support testing the real implementations of
these commands in the future.
2019-04-01 16:30:02 +11:00
Carl Suster
859e16d1e3 bpd: support consume command 2019-04-01 16:30:02 +11:00
Carl Suster
e5851866d7 bpd: add replay_gain_* commands
There's a special status command for checking the replay gain mode,
which can be set to one of a short list of possible values. For now at
least we can ignore this feature, but track the setting anyway.
2019-04-01 14:49:27 +11:00
Carl Suster
67a0b38d20 bpd: add dummy command for volume
MPD supports a deprecated command 'volume' which was used to change the
volume by a relative amount unlike its replacement 'setvol' which uses
an absolute amount. As far as I can tell 'volume' always responds with a system
error message "No mixer".
2019-04-01 14:49:27 +11:00
Carl Suster
1511e313f7 bpd: add mixramp commands
These are a more sophisticated version of crossfade so we're free to
ignore them, at least for now. We now track the values of the two
settings, and show them in the status output. Like MPD, we suppress the
mixrampdb value if it's set to nan, which is how it signals that the
feature should be turned off.
2019-04-01 14:49:27 +11:00
Carl Suster
0f53ae9a87 bpd: error instead of crashing on extra argument
If an MPC client is expecting a command to take an argument that bpd
isn't expecting (e.g. because of a difference in protocol versions) then
bpd currently crashes completely. Instead, do what the real MPD does and
return an error message over the protocol.
2019-04-01 14:49:27 +11:00
Carl Suster
d94a5393b2 bpd: fix crossfade command
Although crossfade is not implemented in bpd, we can store the setting
and repeat is back to clients. Also log a warning that the operation is
not implemented.

The real MPD doesn't show the crossfade in status if it's zero since
that means no crossfade, so now we don't either.
2019-04-01 14:49:27 +11:00
Carl Suster
de6718abdf bpd: separate tests by command category 2019-04-01 14:49:27 +11: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
Carl Suster
999cf14401 BPD tests: change expectedFailure -> skip for nose 2019-03-31 10:50:42 +11:00
Carl Suster
2e35c27dce BPD tests: improve helpers 2019-03-31 10:46:14 +11:00
Carl Suster
eb5c7513a1 BPD tests: fix GstPlayer mock 2019-03-31 10:46:14 +11:00
Carl Suster
2a2d9b5c98 BPD tests: explicitly close client socket 2019-03-31 10:46:14 +11:00
Carl Suster
a6c976b880 BPD tests: small code reformatting 2019-03-31 10:46:14 +11:00
Carl Suster
3eaf0f7a19 BPD tests: use canonical capitalisation of tags 2019-03-31 10:46:14 +11:00
Carl Suster
4c627cbacb [skip travis] BPD tests: add items by path 2019-03-31 10:46:14 +11:00
Carl Suster
dfc5da70cd BPD tests: avoid os.fsdecode new in Py3.2 2019-03-31 10:46:14 +11:00
Carl Suster
14d0cc3b85 BPD tests: be more careful with paths 2019-03-31 10:46:14 +11:00
Carl Suster
7c8bbd3011 BPD tests: avoid Py3.7-only mp.Process.kill 2019-03-31 10:46:14 +11:00
Carl Suster
35bf041ad0 BPD tests: fork and launch beets 2019-03-31 10:46:14 +11:00
Carl Suster
c42c0c06bc BPD tests: fix CI failures 2019-03-31 10:46:14 +11:00
Carl Suster
2286c0ce7b BPD tests: run bpd in a subprocess 2019-03-31 10:46:14 +11:00
Carl Suster
767441d5d5 BPD tests: improve test helpers
Decode the bytes to strings: the MPD protocol specifies that the
communications are all in UTF-8.

Also parse the body into a dict since this is typically more convenient
than having to do it manually in each test.
2019-03-31 10:46:14 +11:00
Carl Suster
d9537f27dc BPD tests: fix CI failures 2019-03-31 10:46:14 +11:00
Carl Suster
76221428f8 Add a DummyIn::close no-op implementation
The BOD tests are currently forking a process with a server running, and
this attempts to close stdin. Tests were failing due to DummyIn not
implementing the close() method. Adding this simple no-op does the trick
to allow forking and seems like a harmless addition.
2019-03-31 10:46:14 +11:00
Carl Suster
5d2b883b72 BPD tests: test several simple commands 2019-03-31 10:46:14 +11:00
Carl Suster
7302cd6ab5 BPD tests: test helper for BPD batch commands
The MPD protocol allows batching commands. There are two choices for the
first message that announced a batch is starting, and we just go for the
one that causes the server to respond with a marker message between each
individual response, since that's easier. This might need to be tweaked
in order to test the behaviour with the other batch indicator.
2019-03-31 10:46:14 +11:00
Carl Suster
9a5be1f971 BPD tests: test supported tag types
MPD now supports more fields ("tags") than what BPD advertises. Fixing
this should be a simple task of extending the mapping of fields to tags
in BPD's implementation.
2019-03-31 10:46:14 +11:00
Carl Suster
acd66ce560 BPD tests: run BPD Server with a fake gstplayer 2019-03-31 10:46:14 +11:00
Carl Suster
acc3f3efb0 BPD tests: check all specified commands known
The current MPD spec is several versions ahead of BPD. These tests just
compare the full specified list of commands against what BPD claims to
support (without actually testing their implementations). It's handy as
a measure of progress against the specification, but can perhaps be
dropped later once all of the individual protocol methods have tests.
2019-03-31 10:46:14 +11:00
Carl Suster
59e66aaa7f BPD tests: password command 2019-03-31 10:46:14 +11:00
Carl Suster
078c583434 BPD tests: add basic test framework
A simple TCP client wraps the low level protocol to allow testing of the
BPD server as a black box.
2019-03-31 10:46:14 +11:00
jroitgrund@gmail.com
ea307f62d1 Don't move album art twice 2019-03-27 01:41:42 +00:00
Jack Wilsdon
25549a656f
Add test for interpolating byte strings in hook plugin 2019-02-25 14:42:20 +00:00
Adrian Sampson
81c5ae3fdf
Merge pull request #3151 from Holzhaus/playlist-plugin-additions
playlist: Add auto-update functionality and more tests
2019-02-18 08:40:55 -05:00
Jan Holthuis
76a3e44aad test: Make music dir of playlist tests Windows-compatible 2019-02-17 21:27:37 +01:00
Jan Holthuis
7ec55a5f3b test: Use unicode literals for library queries in playlist tests 2019-02-17 21:27:09 +01:00
Jan Holthuis
a9dd5a7cdc test: Add testcase for playlist plugin's update functionality 2019-02-17 20:31:15 +01:00
Adrian Sampson
7edba6e9ea Fix test harness for named queries 2019-02-17 14:11:40 -05:00
Jan Holthuis
1af82cc450 test: Split up playlist test helper class 2019-02-17 19:41:37 +01:00
Adrian Sampson
d8e167637e Prototype support for named (pseudo-field) queries
As discussed here:
https://github.com/beetbox/beets/pull/3145#pullrequestreview-204523870

This would replace the need for #3149.
2019-02-17 13:41:05 -05:00
Jan Holthuis
5b68d88346 test: Add more playlist tests for the different relative_to settings 2019-02-17 19:36:26 +01:00
Jan Holthuis
9f3acce2ae test: Add non-existing item to playlist tests 2019-02-17 19:35:54 +01:00
Jan Holthuis
b00b38dab6 test: Add test for relative playlists 2019-02-17 19:35:43 +01:00
Jan Holthuis
14cad04d35 test: Further improve Windows compatibility in playlist plugin test 2019-02-17 19:33:54 +01:00
Adrian Sampson
00667bda0f Merge pull request #3145 from Holzhaus/playlist-plugin
Playlist plugin
2019-02-17 13:16:26 -05:00
Jan Holthuis
d6022e28d7 test: Ensure path quoting in playlist tests 2019-02-17 16:43:36 +01:00
Jan Holthuis
31c687c853 test: Fix playlist plugin path handling for Windows compatibility 2019-02-17 16:17:47 +01:00
Jan Holthuis
32b6df046e test: Don't use unix-only paths in playlist plugin testcase 2019-02-17 15:57:40 +01:00
Jan Holthuis
d4039be9c0 test: Get rid of TemporaryDirectory to restore Python 2.7 compatibility 2019-02-17 15:39:47 +01:00
Jan Holthuis
d52dcdd48f test: Add playlist testcases for nonexisting playlists 2019-02-17 15:17:10 +01:00
Jan Holthuis
0988a2a186 test: Add test suite for the playlist plugin 2019-02-17 15:17:10 +01:00
Rahul Ahuja
7b57b0b608 Appease Flake8 2019-01-22 10:53:18 -08:00
Rahul Ahuja
3a67eae46d Use track attrs directly, better naming/docstrings 2019-01-22 10:41:18 -08:00
Rahul Ahuja
77f9a930b7 Fix remaining test, use official doc wording 2019-01-21 23:15:08 -08:00
Rahul Ahuja
0527edbd48 Fix test index, add docstrings 2019-01-21 23:05:47 -08:00
Rahul Ahuja
2cda2b5b3a Remove hardcoded ordering of filters in tests 2019-01-21 22:53:23 -08:00
Rahul Ahuja
237792a4fb Fix other test_track_request case 2019-01-21 22:40:15 -08:00
Rahul Ahuja
f63beca39a Switch filter ordering in test 2019-01-21 22:35:12 -08:00
Rahul Ahuja
5472a49991 Add candidates and item_candidates, modularize Search API queries 2019-01-21 21:24:41 -08:00
Adrian Sampson
1087740580
Merge pull request #3100 from regagain/fetchart_unittests
Unit tests for fetchart plugin iTunes source
2019-01-21 18:19:08 -05:00
Reg
272bf5940b test_art/iTunesStore: log check fix. 2019-01-21 22:49:19 +01:00
Reg
1be3c954f3 test_art/iTunesStore: Python2 string fix. 2019-01-21 18:26:58 +01:00
Reg
ce35c36762 test_art/iTunesStore: Verify logs. 2019-01-20 23:09:18 +01:00
Rahul Ahuja
b95eaa8ffe fix test, document Spotify ID 2019-01-20 02:20:10 -08:00
Rahul Ahuja
9a30000b56 better naming, formatting 2019-01-20 02:04:46 -08:00
Rahul Ahuja
104f6185ab revert unnecessary double --> single quotes 2019-01-19 23:57:36 -08:00
Rahul Ahuja
337cf2a1c3 appease Flake8 2019-01-19 23:35:06 -08:00
Rahul Ahuja
dc77943da2 try oauth token mock 2019-01-19 23:21:02 -08:00
Reg
088b5b173d test_art/iTunesStore: Check match level is as expected 2019-01-19 14:58:41 +01:00
Reg
57c27039d6 test_art/iTunesStore: renamed test for clarity 2019-01-12 19:54:49 +01:00
Reg
fa32485755 test_art/iTunesStore: requestexception test improvements 2019-01-10 20:03:32 +01:00
Reg
ac09c480c9 test_art/iTunesStore: removed unnecessary statement and renamed test 2018-12-27 09:44:04 +01:00
Reg
5d1c97824c Unit tests for fetchart plugin iTunes source 2018-12-23 17:48:44 +01:00
Reg
f955f72e2c test_fetchart: Fix for hidden files on Windows 2018-12-21 11:27:09 +01:00
Reg
54a83fa941 Fetchart / ignore settings tests 2018-12-20 18:44:55 +01:00
Reg
0696f915e5 test_fetchart: Avoid duplicate code in future tests. 2018-12-20 18:44:55 +01:00
Adrian Sampson
ca359d7e0d
Merge pull request #3085 from jackwilsdon/modify-skip-remaining
Allow exiting object selection early
2018-12-02 14:57:16 -05:00