Robustify the AVM test infrastructure a bit

This commit is contained in:
Peter Williams 2021-09-09 22:31:51 -04:00
Родитель 174aa9e749
Коммит 02be9d4377
4 изменённых файлов: 12 добавлений и 9 удалений

Просмотреть файл

@ -66,7 +66,7 @@ jobs:
if [[ $AGENT_OS == Windows_NT ]] ; then
\conda install -y astropy pytest
else
\conda install -y astropy healpy pytest
\conda install -y astropy healpy pyavm pytest
fi
pytest --pyargs toasty

Просмотреть файл

@ -5,6 +5,7 @@
__all__ = '''
assert_xml_elements_equal
check_xml_elements_equal
HAS_AVM
test_path
'''.split()
@ -17,6 +18,12 @@ def test_path(*pieces):
return os.path.join(TESTS_DIR, *pieces)
try:
import pyavm
HAS_AVM = True
except ImportError:
HAS_AVM = False
def check_xml_elements_equal(observed, expected):
"""See if two XML elements are equal through recursive comparison. We do *not*
check the "tail" text item, and we strip whitespace in "text".

Просмотреть файл

@ -2,15 +2,11 @@
# Copyright 2021 the AAS WorldWide Telescope project
# Licensed under the MIT License.
import numpy as np
from numpy import testing as nt
import os.path
import pytest
import sys
from . import assert_xml_elements_equal, test_path
from . import HAS_AVM, test_path
from .. import cli
from .. import study
class TestAvm(object):
@ -25,6 +21,7 @@ class TestAvm(object):
def work_path(self, *pieces):
return os.path.join(self.work_dir, *pieces)
@pytest.mark.skipif('not HAS_AVM')
def test_check_cli(self):
args = [
'check-avm',

Просмотреть файл

@ -5,12 +5,10 @@
from __future__ import absolute_import, division, print_function
import numpy as np
from numpy import testing as nt
import os.path
import pytest
import sys
from . import assert_xml_elements_equal, test_path
from . import HAS_AVM, assert_xml_elements_equal, test_path
from .. import cli
from .. import study
@ -115,6 +113,7 @@ Permission="0" Searchable="True" Type="Sky">
</Place>
</Folder>"""
@pytest.mark.skipif('not HAS_AVM')
def test_avm(self):
from xml.etree import ElementTree as etree
expected = etree.fromstring(self.AVM_WTML)