You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2022/04/04 08:12:20 UTC
[superset] 20/23: fix: flaky test for dashboard changed on (#19483)
This is an automated email from the ASF dual-hosted git repository.
villebro pushed a commit to tag 1.5.0rc1
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 90f49e261e557cbc195f95e7b33a912053a56aa1
Author: Yongjie Zhao <yo...@gmail.com>
AuthorDate: Fri Apr 1 16:47:56 2022 +0800
fix: flaky test for dashboard changed on (#19483)
(cherry picked from commit a2e921bd035ff1af54c22ecc8e4203af68c6baa8)
---
tests/integration_tests/charts/api_tests.py | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/tests/integration_tests/charts/api_tests.py b/tests/integration_tests/charts/api_tests.py
index 3c92caceea..6b8d625d56 100644
--- a/tests/integration_tests/charts/api_tests.py
+++ b/tests/integration_tests/charts/api_tests.py
@@ -17,11 +17,9 @@
# isort:skip_file
"""Unit tests for Superset"""
import json
-from datetime import datetime
from io import BytesIO
from zipfile import is_zipfile, ZipFile
-import humanize
import prison
import pytest
import yaml
@@ -803,7 +801,6 @@ class TestChartApi(SupersetTestCase, ApiOwnersTestCaseMixin, InsertChartMixin):
Dashboard API: Test get charts changed on
"""
admin = self.get_user("admin")
- start_changed_on = datetime.now()
chart = self.insert_chart("foo_a", [admin.id], 1, description="ZY_bar")
self.login(username="admin")
@@ -817,9 +814,9 @@ class TestChartApi(SupersetTestCase, ApiOwnersTestCaseMixin, InsertChartMixin):
rv = self.get_assert_metric(uri, "get_list")
self.assertEqual(rv.status_code, 200)
data = json.loads(rv.data.decode("utf-8"))
- self.assertEqual(
- data["result"][0]["changed_on_delta_humanized"],
- humanize.naturaltime(datetime.now() - start_changed_on),
+ assert data["result"][0]["changed_on_delta_humanized"] in (
+ "now",
+ "a second ago",
)
# rollback changes