Skip to content

Commit

Permalink
debug windows test fail
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane Maloney committed Feb 13, 2021
1 parent c4dd9a8 commit 0b533d0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 28 deletions.
1 change: 0 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ stages:
submodules: false
coverage: codecov
toxdeps: tox-pypi-filter
posargs: -n=4

libraries:
apt:
Expand Down
46 changes: 23 additions & 23 deletions radiospectra/net/sources/psp.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,30 @@ class RFSClient(GenericClient):
Examples
--------
>>> import radiospectra.net
>>> from sunpy.net import Fido, attrs as a
>>> results = Fido.search(a.Time("2019/10/02", "2019/10/05"),
... a.Instrument('rfs')) #doctest: +REMOTE_DATA
>>> print(results) #doctest: +REMOTE_DATA
Results from 1 Provider:
<BLANKLINE>
8 Results from the RFSClient:
Start Time End Time ... Provider Wavelength [2]
... kHz
----------------------- ----------------------- ... -------- -----------------
2019-10-02 00:00:00.000 2019-10-02 23:59:59.999 ... SPDF 10.0 .. 1700.0
2019-10-03 00:00:00.000 2019-10-03 23:59:59.999 ... SPDF 10.0 .. 1700.0
2019-10-04 00:00:00.000 2019-10-04 23:59:59.999 ... SPDF 10.0 .. 1700.0
2019-10-05 00:00:00.000 2019-10-05 23:59:59.999 ... SPDF 10.0 .. 1700.0
2019-10-02 00:00:00.000 2019-10-02 23:59:59.999 ... SPDF 1300.0 .. 19200.0
2019-10-03 00:00:00.000 2019-10-03 23:59:59.999 ... SPDF 1300.0 .. 19200.0
2019-10-04 00:00:00.000 2019-10-04 23:59:59.999 ... SPDF 1300.0 .. 19200.0
2019-10-05 00:00:00.000 2019-10-05 23:59:59.999 ... SPDF 1300.0 .. 19200.0
<BLANKLINE>
<BLANKLINE>
# >>> import radiospectra.net
# >>> from sunpy.net import Fido, attrs as a
# >>> results = Fido.search(a.Time("2019/10/02", "2019/10/05"),
# ... a.Instrument('rfs')) #doctest: +REMOTE_DATA
# >>> print(results) #doctest: +REMOTE_DATA
# Results from 1 Provider:
# <BLANKLINE>
# 8 Results from the RFSClient:
# Start Time End Time ... Provider Wavelength [2]
# ... kHz
# ----------------------- ----------------------- ... -------- -----------------
# 2019-10-02 00:00:00.000 2019-10-02 23:59:59.999 ... SPDF 10.0 .. 1700.0
# 2019-10-03 00:00:00.000 2019-10-03 23:59:59.999 ... SPDF 10.0 .. 1700.0
# 2019-10-04 00:00:00.000 2019-10-04 23:59:59.999 ... SPDF 10.0 .. 1700.0
# 2019-10-05 00:00:00.000 2019-10-05 23:59:59.999 ... SPDF 10.0 .. 1700.0
# 2019-10-02 00:00:00.000 2019-10-02 23:59:59.999 ... SPDF 1300.0 .. 19200.0
# 2019-10-03 00:00:00.000 2019-10-03 23:59:59.999 ... SPDF 1300.0 .. 19200.0
# 2019-10-04 00:00:00.000 2019-10-04 23:59:59.999 ... SPDF 1300.0 .. 19200.0
# 2019-10-05 00:00:00.000 2019-10-05 23:59:59.999 ... SPDF 1300.0 .. 19200.0
# <BLANKLINE>
# <BLANKLINE>
"""

baseurl = (r'https://spdf.gsfc.nasa.gov/pub/data/psp/fields/l2/{Wavelength}/'
r'{year}/psp_fld_l2_(\w){{7}}_(\d){{8}}_v(\d){{2}}.cdf')
baseurl = (r'https://spdf.gsfc.nasa.gov/pub/data/psp/fields/l2/{Wavelength}/{year}/psp_fld_l2_(\w){{7}}_(\d){{8}}_v(\d){{2}}.cdf') # NOQA
pattern = r'{}/{Wavelength}/{year:4d}/' \
r'psp_fld_l2_{Wavelength}_{year:4d}{month:2d}{day:2d}_v{:2d}.cdf'

Expand Down Expand Up @@ -111,6 +110,7 @@ def search(self, *args, **kwargs):
for receiver in receivers:
for year in range(start_year, end_year+1):
urlpattern = self.baseurl.format(Wavelength=receiver, year=year)
print('Url pattern: ', urlpattern)
scraper = Scraper(urlpattern, regex=True)
filesmeta = scraper._extract_files_meta(tr, extractor=self.pattern)
for i in filesmeta:
Expand Down
11 changes: 7 additions & 4 deletions radiospectra/net/sources/tests/test_psp_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@

from radiospectra.net.sources.psp import RFSClient

client = RFSClient()

@pytest.fixture
def client():
return RFSClient()


@pytest.mark.parametrize("req_wave,receivers", [
Expand Down Expand Up @@ -82,7 +85,7 @@ def test_search_with_wavelength(mock_urlopen, client, http_responces):


@pytest.mark.remote_data
def test_get_url_for_time_range():
def test_get_url_for_time_range(client):
url_start = 'https://spdf.gsfc.nasa.gov/pub/data/psp/fields/l2/rfs_lfr/2019/' \
'psp_fld_l2_rfs_lfr_20191001_v02.cdf'
url_end = 'https://spdf.gsfc.nasa.gov/pub/data/psp/fields/l2/rfs_hfr/2019/' \
Expand All @@ -94,7 +97,7 @@ def test_get_url_for_time_range():
assert urls[-1] == url_end


def test_can_handle_query():
def test_can_handle_query(client):
atr = a.Time('2019/10/01', '2019/11/01')
res = client._can_handle_query(atr, a.Instrument('rfs'))
assert res is True
Expand All @@ -103,7 +106,7 @@ def test_can_handle_query():


@pytest.mark.remote_data
def test_get():
def test_get(client):
query = client.search(a.Time('2019/10/05', '2019/10/10'), a.Instrument('rfr'))
download_list = client.fetch(query)
assert len(download_list) == len(query)

0 comments on commit 0b533d0

Please sign in to comment.