Robustify the AVM test infrastructure a bit
This commit is contained in:
Родитель
174aa9e749
Коммит
02be9d4377
|
@ -66,7 +66,7 @@ jobs:
|
||||||
if [[ $AGENT_OS == Windows_NT ]] ; then
|
if [[ $AGENT_OS == Windows_NT ]] ; then
|
||||||
\conda install -y astropy pytest
|
\conda install -y astropy pytest
|
||||||
else
|
else
|
||||||
\conda install -y astropy healpy pytest
|
\conda install -y astropy healpy pyavm pytest
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pytest --pyargs toasty
|
pytest --pyargs toasty
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
__all__ = '''
|
__all__ = '''
|
||||||
assert_xml_elements_equal
|
assert_xml_elements_equal
|
||||||
check_xml_elements_equal
|
check_xml_elements_equal
|
||||||
|
HAS_AVM
|
||||||
test_path
|
test_path
|
||||||
'''.split()
|
'''.split()
|
||||||
|
|
||||||
|
@ -17,6 +18,12 @@ def test_path(*pieces):
|
||||||
return os.path.join(TESTS_DIR, *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):
|
def check_xml_elements_equal(observed, expected):
|
||||||
"""See if two XML elements are equal through recursive comparison. We do *not*
|
"""See if two XML elements are equal through recursive comparison. We do *not*
|
||||||
check the "tail" text item, and we strip whitespace in "text".
|
check the "tail" text item, and we strip whitespace in "text".
|
||||||
|
|
|
@ -2,15 +2,11 @@
|
||||||
# Copyright 2021 the AAS WorldWide Telescope project
|
# Copyright 2021 the AAS WorldWide Telescope project
|
||||||
# Licensed under the MIT License.
|
# Licensed under the MIT License.
|
||||||
|
|
||||||
import numpy as np
|
|
||||||
from numpy import testing as nt
|
|
||||||
import os.path
|
import os.path
|
||||||
import pytest
|
import pytest
|
||||||
import sys
|
|
||||||
|
|
||||||
from . import assert_xml_elements_equal, test_path
|
from . import HAS_AVM, test_path
|
||||||
from .. import cli
|
from .. import cli
|
||||||
from .. import study
|
|
||||||
|
|
||||||
|
|
||||||
class TestAvm(object):
|
class TestAvm(object):
|
||||||
|
@ -25,6 +21,7 @@ class TestAvm(object):
|
||||||
def work_path(self, *pieces):
|
def work_path(self, *pieces):
|
||||||
return os.path.join(self.work_dir, *pieces)
|
return os.path.join(self.work_dir, *pieces)
|
||||||
|
|
||||||
|
@pytest.mark.skipif('not HAS_AVM')
|
||||||
def test_check_cli(self):
|
def test_check_cli(self):
|
||||||
args = [
|
args = [
|
||||||
'check-avm',
|
'check-avm',
|
||||||
|
|
|
@ -5,12 +5,10 @@
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from numpy import testing as nt
|
|
||||||
import os.path
|
import os.path
|
||||||
import pytest
|
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 cli
|
||||||
from .. import study
|
from .. import study
|
||||||
|
|
||||||
|
@ -115,6 +113,7 @@ Permission="0" Searchable="True" Type="Sky">
|
||||||
</Place>
|
</Place>
|
||||||
</Folder>"""
|
</Folder>"""
|
||||||
|
|
||||||
|
@pytest.mark.skipif('not HAS_AVM')
|
||||||
def test_avm(self):
|
def test_avm(self):
|
||||||
from xml.etree import ElementTree as etree
|
from xml.etree import ElementTree as etree
|
||||||
expected = etree.fromstring(self.AVM_WTML)
|
expected = etree.fromstring(self.AVM_WTML)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче