Commit Graph

31 Commits

Author SHA1 Message Date
Laurent Monin
2f6479747d Update headers 2022-02-07 09:41:57 +01:00
Laurent Monin
820551d513 Move FILE_INFO_TAGS to File class and reduce code redundancy
- add a test for File._copy_file_info_tags()
2022-01-04 12:00:19 +01:00
Laurent Monin
14ce07756e Update Copyright headers, with the help of fix-headers.py script 2021-11-10 21:38:54 +01:00
Laurent Monin
5b396ea766 Move part of File.update() code to a new generator File._tags_to_update()
- test it separately
- override File.supports_tag() for all tests, it ensures consistency
2021-11-10 18:06:01 +01:00
Laurent Monin
ca6cee6096 Simplify tests 2021-11-10 16:03:46 +01:00
Laurent Monin
da5fabc63f Also test with initial default state File.PENDING where it makes sense 2021-11-10 12:47:53 +01:00
Laurent Monin
9d5d0fd01e File.update(): add tests, 100% coverage
pytest --verbose --cov=picard --cov-report html test/test_file.py -k "FileUpdateTest"
2021-11-10 11:38:55 +01:00
Laurent Monin
93a8d83365 Make _compile_move_additional_files_pattern() a static method and simplify tests
- do not pass config but the patterns string
- make it a static method (it doesn't need self anyway)
- simplify tests accordingly
2021-11-09 21:43:40 +01:00
Laurent Monin
37982bed94 Also test weird whitespacing, multiple or newlines 2021-11-09 17:42:48 +01:00
Laurent Monin
baba955cf0 Since the pattern matching is case-insensitive, lowercase pattern string
- it helps to remove duplicates (like cover.jpg cover.JPG)
- fix test accordingly
2021-11-09 17:27:15 +01:00
Laurent Monin
21c5722f5a Add tests for File._compile_move_additional_files_pattern() 2021-11-09 13:18:27 +01:00
Laurent Monin
a213b5e4ea Fix tests 2021-09-16 10:38:21 +02:00
Bob Swift
3764518d7f Fix tests. 2021-06-13 17:45:21 -06:00
Laurent Monin
ab54651438 Update headers 2021-06-03 13:20:42 +02:00
Laurent Monin
16b6fe3473 Add tests for File._guess_tracknumber_and_title() 2021-06-03 13:00:41 +02:00
Philipp Wolfer
6d8ddca958 PICARD-2220: Add default extension to files without extension
Added tests for handling file extensions (missing, lowercasing, scripted).
2021-06-02 20:22:01 +02:00
Philipp Wolfer
d6cf57f548 PICARD-2219: Fix empty renaming script breaking the filename
A renaming script evaluating to an empty name would cause files to be renamed to e.g. "_mp3", breaking the file extension. Now the original filename will be kept.
2021-06-02 11:32:32 +02:00
Sophist
a5fcde1dd3 PICARD-2174: Optimize implementation to display format specific metadata 2021-04-30 11:43:37 +02:00
Philipp Wolfer
c0e6243a13 PICARD-1926: Adjust test cases for new config structure 2020-12-25 12:37:15 +01:00
Philipp Wolfer
fb83a8e76b Enable flake8 E265: Block comment should start with '# '
Most changes involve replacing non-breaking space with a simple space after the #.
2020-05-13 11:03:13 +02:00
Laurent Monin
6b5e852a60 Run fix-header on *.py 2020-02-24 10:25:09 +01:00
Philipp Wolfer
7e350da299 Refactor File to handle acoustid_fingerprint
acoustid_fingerprint is now a normal attribute of File and always available. Adding and removing the file to and from the AcoustIDManager is now completely handled in File.
2020-02-20 07:29:51 +00:00
Laurent Monin
498c8eab1b Add mktmpdir method to PicardTestCase, and use it more widely 2020-02-08 18:04:39 +01:00
Laurent Monin
b7389a6445 Tests: ensure temporary directories and files are removed after tests
- QSettings object needs special care, as file was re-created on exit
- Append a cleanup function as soon as possible to ensure temporary dirs & files are removed in any case
- prefer addCleanup() over tearDown(), keeping creation and cleanup together
2020-02-08 18:04:39 +01:00
Philipp Wolfer
7c6929286b Apply utime test workaround for all macOS versions.
This also seems not only on the macOS version but also on the Python build being used. On the build server with macOS 10.15 this works with the Python binaries provided on the server, but fails with official binaries from python.org.
2020-02-06 19:55:42 +01:00
Philipp Wolfer
157d3cfc97 Fixed file naming tests on Windows 2019-08-07 08:47:22 +02:00
Philipp Wolfer
9d67a45bde Added tests for File.make_filename 2019-08-05 19:32:47 +02:00
Philipp Wolfer
f4d27d1fcc PICARD-1561: On macOS 10.14 test preserve time only with second accuracy 2019-07-23 10:08:26 +02:00
Laurent Monin
a9cf9d55c8 File._preserve_times(): fix broken logic
- access times are likely to differ, a race condition is possible
- stat() has be done after the change to be able to compare
- comments added
- force sync after modifying test file
- make code easier to understand

See https://github.com/metabrainz/picard/pull/1132#issuecomment-474113665
2019-03-19 23:21:59 +01:00
Laurent Monin
6a63c3e5be Improve file times preservation using os.utime() ns parameter (py >= 3.3)
https://docs.python.org/3/library/os.html#os.utime
Since Python 3.3, ns parameter is available
"The best way to preserve exact times is to use the st_atime_ns and st_mtime_ns
fields from the os.stat() result object with the ns parameter to utime."

Make time preservation testable.
2019-03-14 10:57:55 +01:00
Philipp Wolfer
68d5bb3b33 PICARD-1341: Fix cluster sorting by disc and track number 2018-11-25 11:17:22 +01:00