diff --git a/tests/test_schema2.py b/tests/test_schema2.py index a060f6b..adaa1a7 100644 --- a/tests/test_schema2.py +++ b/tests/test_schema2.py @@ -1,7 +1,9 @@ import json import os +import re import pytest +from tabulate import tabulate from utils import login, get_table @@ -20,6 +22,14 @@ def pytest_generate_tests(metafunc): metafunc.parametrize(['visualization'], [[x] for x in tables]) +def assert_equal_tables(table1, table2): + t1 = tabulate(table1) + t2 = tabulate(table2) + t1 = re.sub(' +', ' ', t1) + t2 = re.sub(' +', ' ', t2) + assert t1 == t2 + + @pytest.fixture(autouse=True) def freezetime(freezer): freezer.move_to('2018-12-07 16:53:00') @@ -31,4 +41,7 @@ def test_simple(schema2, app, admin, visualization): visualization_page = response.click(lambda x: x == visualization) assert 'big-msg-info' not in visualization_page - assert schema2['tables'][visualization] == get_table(visualization_page) + table = get_table(visualization_page) + assert_equal_tables( + schema2['tables'][visualization], + table) diff --git a/tox.ini b/tox.ini index b571306..a4e6d5c 100644 --- a/tox.ini +++ b/tox.ini @@ -24,6 +24,7 @@ deps = WebTest django-webtest<1.9.3 pyquery + tabulate commands = dj111: py.test {posargs: --junitxml=test_{envname}_results.xml --cov-report xml --cov-report html --cov=bijoe tests/} [pytest]