Skip to content

Commit

Permalink
More test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadair committed Dec 13, 2018
1 parent 4eaef69 commit 7876986
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Expand Up @@ -53,7 +53,7 @@ jobs:
command: /opt/python/cp36-cp36m/bin/pip install --progress-bar off numpy scipy astropy matplotlib==1.5.3
- run:
name: Install dependencies two
command: /opt/python/cp36-cp36m/bin/pip install --progress-bar off sqlalchemy scikit-image==0.13.1 glymur drms suds-jurko beautifulsoup4 requests python-dateutil pytest pytest-cov pytest-mock pytest-xdist mock hypothesis pytest-astropy pytest-rerunfailures
command: /opt/python/cp36-cp36m/bin/pip install --progress-bar off sqlalchemy scikit-image==0.13.1 glymur drms zeep beautifulsoup4 requests python-dateutil pytest pytest-cov pytest-mock pytest-xdist mock hypothesis pytest-astropy pytest-rerunfailures
- run:
name: Run tests
command: PYTHONHASHSEED=42 /opt/python/cp36-cp36m/bin/python setup.py test --parallel=4
Expand Down
7 changes: 7 additions & 0 deletions docs/conf.py
Expand Up @@ -68,6 +68,13 @@
os.environ['LANG'] = 'C'
os.environ['LC_ALL'] = 'C'

try:
import zeep
except ImportError:
print('ERROR: zeep could not be imported. Building the documentation requires '
'the "zeep" package to be installed')
sys.exit(1)

try:
import skimage
except ImportError:
Expand Down
16 changes: 8 additions & 8 deletions sunpy/database/tables.py
Expand Up @@ -284,17 +284,17 @@ def _from_query_result_block(cls, qr_block, default_waveunit=None):
... vso.attrs.Instrument('eit')) # doctest: +REMOTE_DATA
>>> entry = DatabaseEntry._from_query_result_block(qr[0]) # doctest: +REMOTE_DATA
>>> entry.source # doctest: +REMOTE_DATA
SOHO
'SOHO'
>>> entry.provider # doctest: +REMOTE_DATA
SDAC
'SDAC'
>>> entry.physobs # doctest: +REMOTE_DATA
'intensity'
>>> entry.fileid # doctest: +REMOTE_DATA
/archive/soho/private/data/processed/eit/lz/2001/01/efz20010101.000042
'/archive/soho/private/data/processed/eit/lz/2001/01/efz20010101.000042'
>>> entry.observation_time_start, entry.observation_time_end # doctest: +REMOTE_DATA
(datetime.datetime(2001, 1, 1, 0, 0, 42), datetime.datetime(2001, 1, 1, 0, 0, 54))
>>> entry.instrument # doctest: +REMOTE_DATA
EIT
'EIT'
>>> entry.size # doctest: +REMOTE_DATA
2059.0
>>> entry.wavemin, entry.wavemax # doctest: +REMOTE_DATA
Expand Down Expand Up @@ -512,17 +512,17 @@ def entries_from_query_result(qr, default_waveunit=None):
>>> entries = entries_from_query_result(qr) # doctest: +REMOTE_DATA
>>> entry = next(entries) # doctest: +REMOTE_DATA
>>> entry.source # doctest: +REMOTE_DATA
SOHO
'SOHO'
>>> entry.provider # doctest: +REMOTE_DATA
SDAC
'SDAC'
>>> entry.physobs # doctest: +REMOTE_DATA
'intensity'
>>> entry.fileid # doctest: +REMOTE_DATA
/archive/soho/private/data/processed/eit/lz/2001/01/efz20010101.000042
'/archive/soho/private/data/processed/eit/lz/2001/01/efz20010101.000042'
>>> entry.observation_time_start, entry.observation_time_end # doctest: +REMOTE_DATA
(datetime.datetime(2001, 1, 1, 0, 0, 42), datetime.datetime(2001, 1, 1, 0, 0, 54))
>>> entry.instrument # doctest: +REMOTE_DATA
EIT
'EIT'
>>> entry.size # doctest: +REMOTE_DATA
2059.0
>>> entry.wavemin, entry.wavemax # doctest: +REMOTE_DATA
Expand Down
1 change: 0 additions & 1 deletion sunpy/database/tests/test_attrs.py
Expand Up @@ -53,7 +53,6 @@ def vso_session():
entries = tables.entries_from_query_result(qr)
database = Database('sqlite:///:memory:')
for entry in entries:
print(entry)
database.add(entry)
database.commit()
return database.session
Expand Down
3 changes: 1 addition & 2 deletions sunpy/database/tests/test_tables.py
Expand Up @@ -130,7 +130,7 @@ def test_entries_from_fido_search_result(fido_search_result):
fileid='EVE_L1_esp_2012001_00',
observation_time_start=datetime(2012, 1, 1, 0, 0),
observation_time_end=datetime(2012, 1, 2, 0, 0),
instrument='EVE', size=-1.0,
instrument='EVE',
wavemin=0.1, wavemax=30.4)
# 2 entries from goes
assert entries[56] == DatabaseEntry(
Expand Down Expand Up @@ -249,7 +249,6 @@ def test_entry_from_qr_block_kev(qr_block_with_kev_unit):
assert entry.observation_time_start == datetime(2011, 9, 20, 1, 9, 20)
assert entry.observation_time_end == datetime(2011, 9, 20, 2, 27, 40)
assert entry.instrument == 'RHESSI'
assert entry.size == -1
assert round(entry.wavemin, 3) == 0.413
assert round(entry.wavemax, 7) == 0.0000729

Expand Down
13 changes: 7 additions & 6 deletions sunpy/net/helio/hec.py
Expand Up @@ -3,12 +3,13 @@
"""
import io

from sunpy.net.helio import parser
from sunpy.time import parse_time
from zeep.client import Client as C
import zeep
from lxml import etree

from astropy.io.votable.table import parse_single_table

from sunpy.time import parse_time
from sunpy.net.helio import parser

__all__ = ['HECClient']

Expand All @@ -25,7 +26,7 @@ def votable_handler(xml_table):
Parameters
----------
xml_table : str
xml_table : `bytes`
Contains the VOtable style xml data
Returns
Expand All @@ -35,7 +36,7 @@ def votable_handler(xml_table):
"""
fake_file = io.BytesIO()
fake_file.write(bytes(xml_table, "utf-8"))
fake_file.write(xml_table)
votable = parse_single_table(fake_file)
fake_file.close()
return votable
Expand Down Expand Up @@ -67,7 +68,7 @@ def __init__(self, link=None):
# The default wsdl file
link = parser.wsdl_retriever()

self.hec_client = C(link)
self.hec_client = zeep.Client(link)

def time_query(self, start_time, end_time, table=None, max_records=None):
"""
Expand Down
3 changes: 1 addition & 2 deletions sunpy/net/vso/vso.py
Expand Up @@ -102,8 +102,7 @@ def get_online_vso_url(api, url, port):
if api is None and (url is None or port is None):
for mirror in DEFAULT_URL_PORT:
if check_connection(mirror['url']):
settings = zeep.Settings(strict=True)
api = zeep.Client(mirror['url'], settings=settings, port_name=mirror['port'])
api = zeep.Client(mirror['url'], port_name=mirror['port'])
api.set_ns_prefix('VSO', 'http://virtualsolar.org/VSO/VSOi')
return api

Expand Down

0 comments on commit 7876986

Please sign in to comment.