From f828b347016cce798ea31d7b54b9c571dd951e80 Mon Sep 17 00:00:00 2001 From: karajan1001 Date: Wed, 5 Apr 2023 17:58:30 +0800 Subject: [PATCH] Update test bucket move to my personal account 1. Update anonymous bucket name 2. Add timezone offset for info from OSS --- tests/conftest.py | 4 ++-- tests/test_object.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index fe577ea..05d2032 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -90,8 +90,8 @@ def put_file(endpoint, bucket_name, key, filename): @pytest.fixture(scope="session") -def file_in_anonymous(endpoint, test_directory): - bucket = "dvc-anonymous" +def file_in_anonymous(endpoint, test_directory, test_bucket_name): + bucket = f"{test_bucket_name}-anonymous" file = f"{test_directory}/file" put_object(endpoint, bucket, file, "foobar") return f"/{bucket}/{file}" diff --git a/tests/test_object.py b/tests/test_object.py index f3fcea7..ca65472 100644 --- a/tests/test_object.py +++ b/tests/test_object.py @@ -21,7 +21,9 @@ def test_info(ossfs, test_path): ossfs.touch(test_info_b) info = ossfs.info(test_info_a) linfo = ossfs.ls(test_info_a, detail=True)[0] - assert abs(info.pop("LastModified") - linfo.pop("LastModified")) <= 1 + offset = time.timezone if (time.localtime().tm_isdst == 0) else time.altzone + + assert abs(info.pop("LastModified") - linfo.pop("LastModified") + offset) <= 1 assert info == linfo # test not exist dir