Skip to content

Commit aeeeabd

Browse files
committed
adding optional verify false kwargs for ssl tests
1 parent 9efc5c1 commit aeeeabd

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

python/sdss_access/path/path.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@
3939

4040

4141
def check_public_release(release: str = None, public: bool = False) -> bool:
42-
""" Check if a release is public
43-
42+
""" Check if a release is public
43+
4444
Checks a given release to see if it is public. A release is public if it
4545
contains "DR" in the release name, and if todays date is <= the release_date
46-
as specified in the Tree.
47-
46+
as specified in the Tree.
47+
4848
Parameters
4949
----------
5050
release : str
@@ -56,15 +56,15 @@ def check_public_release(release: str = None, public: bool = False) -> bool:
5656
-------
5757
bool
5858
If the release if public
59-
59+
6060
Raises
6161
------
6262
AttributeError
6363
when tree does not have a valid release date for a DR tree config
6464
"""
6565
today = datetime.datetime.now().date()
6666
release_date = getattr(tree, 'release_date', None)
67-
67+
6868
# check if tree has a valid release date attr
6969
if release_date is None and "DR" in tree.release:
7070
raise AttributeError("Cannot find a valid release date in the sdss-tree product. Try upgrading to min. version 3.1.0.")
@@ -118,11 +118,11 @@ def __init__(self, release=None, public=False, mirror=False, verbose=False,
118118
self.templates = tree.paths
119119
if self.release:
120120
self.replant_tree(release=self.release)
121-
121+
122122
# set public and mirror keywords
123123
self.public = check_public_release(release=self.release, public=public)
124124
self.mirror = mirror
125-
125+
126126
# set the server location and remote base
127127
self.set_netloc()
128128
self.set_remote_base()
@@ -327,7 +327,7 @@ def extract(self, name, example):
327327
elif re.search('@healpixgrp[|]', template):
328328
template = re.sub('@healpixgrp[|]', '{healpixgrp}', template)
329329
elif re.search('@configgrp[|]', template):
330-
template = re.sub('@configgrp[|]', '{configgrp}', template)
330+
template = re.sub('@configgrp[|]', '{configgrp}', template)
331331
if re.search('@plateid6[|]', template):
332332
template = re.sub('@plateid6[|]', '{plateid:0>6}', template)
333333

@@ -444,8 +444,9 @@ def exists(self, filetype, remote=None, **kwargs):
444444
if remote:
445445
# check for remote existence using a HEAD request
446446
url = self.url('', full=full)
447+
verify = kwargs.get('verify', True)
447448
try:
448-
resp = requests.head(url, allow_redirects=True)
449+
resp = requests.head(url, allow_redirects=True, verify=verify)
449450
except Exception as e:
450451
raise AccessError('Cannot check for remote file existence for {0}: {1}'.format(url, e))
451452
else:

tests/path/test_path.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def test_public(self):
3939
@pytest.mark.parametrize('place, exp', [('local', False), ('remote', True)])
4040
def test_existence(self, path, place, exp):
4141
full = path.full('mangaimage', drpver='v2_5_3', plate=8116, ifu=1901, dir3d='mastar')
42-
exists = path.exists('', full=full, remote=(place == 'remote'))
42+
exists = path.exists('', full=full, remote=(place == 'remote'), verify=False)
4343
assert exp == exists
4444

4545
def test_lookup_names(self, path):
@@ -297,7 +297,7 @@ def test_svn_force_module(self, monkeyoos, path):
297297
path = Path(release='DR15')
298298
ff = path.full('mangapreimg', designid=8405, designgrp='D0084XX', mangaid='1-42007')
299299
assert 'mangapreim/v2_5/data' in ff
300-
300+
301301
ff = path.full('mangapreimg', designid=8405, designgrp='D0084XX', mangaid='1-42007', force_module=True)
302302
assert 'mangapreim/trunk/data' in ff
303303

0 commit comments

Comments
 (0)