-
-
Notifications
You must be signed in to change notification settings - Fork 423
Cosmosim latest unittests #600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0db4f88
Attempting to hook/fix new CosmoSim tests into the astroquery testing…
agroener cf8fe6a
Added setup_package.py file in cosmosim.
agroener 1edd62a
Minor changes to tests.
agroener 2aaf702
Debugging some unittests.
agroener 8fd0aaa
Testing login/logout of cosmosim module.
agroener de3a650
Made progress with tests. Not done testing special login/logout cases.
agroener File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Licensed under a 3-clause BSD style license - see LICENSE.rst | ||
from __future__ import absolute_import | ||
|
||
import os | ||
|
||
|
||
def get_package_data(): | ||
paths = [os.path.join('data', '*.pickle'), | ||
os.path.join('data', '*.html'), | ||
os.path.join('data', '*.tbl'), | ||
] | ||
return {'astroquery.cosmosim.tests': paths} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Licensed under a 3-clause BSD style license - see LICENSE.rst | ||
|
||
import os | ||
import tempfile | ||
import shutil | ||
from astropy.tests.helper import pytest, remote_data | ||
# VV temporary | ||
import ipdb | ||
# ^^ temporary | ||
try: | ||
import keyring | ||
HAS_KEYRING = True | ||
except: | ||
HAS_KEYRING = False | ||
try: | ||
from ...cosmosim import CosmoSim | ||
COSMOSIM_IMPORTED = True | ||
except: | ||
COSMOSIM_IMPORTED = False | ||
from ...exceptions import LoginError | ||
SKIP_TESTS = not(HAS_KEYRING and COSMOSIM_IMPORTED) | ||
|
||
@pytest.mark.skipif('SKIP_TESTS') | ||
@remote_data | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since this is remote, it should go into |
||
class TestCosmoSim: | ||
@pytest.fixture() | ||
def temp_dir(self, request): | ||
my_temp_dir = tempfile.mkdtemp() | ||
def fin(): | ||
shutil.rmtree(my_temp_dir) | ||
request.addfinalizer(fin) | ||
return my_temp_dir | ||
|
||
def test_login(self): | ||
""" | ||
Tests a simple login with public credentials. | ||
""" | ||
cosmosim = CosmoSim() | ||
# wrong login credentials | ||
with pytest.raises(LoginError) as exc: | ||
cosmosim.login(username='public', password='wrong') | ||
assert exc.value.args[0] == 'Authentication failed!' | ||
cosmosim.logout() | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could use
list(self.job_dict.keys())
for the same effectThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes - I definitely tried casting to a list straight away. However, oddly enough, it gave me issues. I had to actually do a list comprehension to fix this. Nonetheless, I'm going to see if it works.