mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-01-08 18:22:30 +01:00
Fix build error due to failed `test_bucket.py` test.
```
_____________ BucketPluginTest.test_year_single_year_last_folder ______________
self = <test.plugins.test_bucket.BucketPluginTest testMethod=test_year_single_year_last_folder>
def test_year_single_year_last_folder(self):
"""If a single year is given for the last bucket, extend it to current
year."""
self._setup_config(bucket_year=["1950", "1970"])
assert self.plugin._tmpl_bucket("2014") == "1970"
> assert self.plugin._tmpl_bucket("2025") == "2025"
E AssertionError: assert '1970' == '2025'
E
E - 2025
E + 1970
test/plugins/test_bucket.py:54: AssertionError
```
39 lines
1.2 KiB
Diff
39 lines
1.2 KiB
Diff
Patch-Source: https://github.com/beetbox/beets/pull/5566
|
|
---
|
|
From bcc79a5b09225050ce7c88f63dfa56f49f8782a8 Mon Sep 17 00:00:00 2001
|
|
From: Stefano Rivera <stefano@rivera.za.net>
|
|
Date: Fri, 27 Dec 2024 16:27:30 -0400
|
|
Subject: [PATCH] Future proof
|
|
BucketPluginTest.test_year_single_year_last_folder
|
|
|
|
2025 won't be in the future, forever.
|
|
|
|
Fixes: https://bugs.debian.org/1091495
|
|
---
|
|
test/plugins/test_bucket.py | 5 ++++-
|
|
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/test/plugins/test_bucket.py b/test/plugins/test_bucket.py
|
|
index b075bc4f23..e3611912a5 100644
|
|
--- a/test/plugins/test_bucket.py
|
|
+++ b/test/plugins/test_bucket.py
|
|
@@ -14,6 +14,8 @@
|
|
|
|
"""Tests for the 'bucket' plugin."""
|
|
|
|
+from datetime import datetime
|
|
+
|
|
import pytest
|
|
|
|
from beets import config, ui
|
|
@@ -51,7 +53,8 @@ def test_year_single_year_last_folder(self):
|
|
year."""
|
|
self._setup_config(bucket_year=["1950", "1970"])
|
|
assert self.plugin._tmpl_bucket("2014") == "1970"
|
|
- assert self.plugin._tmpl_bucket("2025") == "2025"
|
|
+ next_year = datetime.now().year + 1
|
|
+ assert self.plugin._tmpl_bucket(str(next_year)) == str(next_year)
|
|
|
|
def test_year_two_years(self):
|
|
"""Buckets can be named with the 'from-to' syntax."""
|