Skip to content

Commit

Permalink
Merge pull request #321 from mwcraig/IFC-windows
Browse files Browse the repository at this point in the history
Fix ImageFileCollection tests on Windows
  • Loading branch information
crawfordsm committed Mar 8, 2016
2 parents 216d4f0 + 16fc925 commit 725dc41
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
6 changes: 5 additions & 1 deletion ccdproc/tests/pytest_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,11 @@ def triage_setup(request):
def teardown():
for key in n_test.keys():
n_test[key] = 0
rmtree(test_dir)
try:
rmtree(test_dir)
except OSError:
# If we cannot clean up just keep going.
pass
os.chdir(original_dir)
request.addfinalizer(teardown)

Expand Down
14 changes: 9 additions & 5 deletions ccdproc/tests/test_image_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
_original_dir = ''


@pytest.mark.skipif("os.environ.get('APPVEYOR')",
reason="fails on AppVeyor/Windows")
def test_fits_summary(triage_setup):
keywords = ['imagetyp', 'filter']
ic = image_collection.ImageFileCollection(triage_setup.test_dir,
Expand Down Expand Up @@ -393,10 +391,11 @@ def test_unknown_generator_type_raises_error(self, triage_setup):
def test_setting_write_location_to_bad_dest_raises_error(self, tmpdir,
triage_setup):
new_tmp = tmpdir.mkdtemp()
os.chmod(new_tmp.strpath, stat.S_IREAD)
bad_directory = new_tmp.join('foo')

ic = image_collection.ImageFileCollection(triage_setup.test_dir, keywords=['naxis'])
with pytest.raises(IOError):
for hdr in ic.headers(save_location=new_tmp.strpath):
for hdr in ic.headers(save_location=bad_directory.strpath):
pass

def test_initializing_from_table(self, triage_setup):
Expand Down Expand Up @@ -540,10 +539,15 @@ def test_header_with_long_history_roundtrips_to_disk(self, triage_setup):
table_disk = Table.read('test_table.txt', format='ascii.csv')
assert len(table_disk) == len(ic.summary_info)

def test_refresh_method_sees_added_keywords(self, triage_setup):
@pytest.mark.skipif("os.environ.get('APPVEYOR') or os.sys.platform == 'win32'",
reason="fails on Windows because file "
"overwriting fails")

def test_refresh_method_sees_added_keywords(self, triage_setup, tmpdir):
ic = image_collection.ImageFileCollection(triage_setup.test_dir, keywords='*')
# Add a keyword I know isn't already in the header to each file.
not_in_header = 'BARKARK'

for h in ic.headers(overwrite=True):
h[not_in_header] = True
print(h)
Expand Down

0 comments on commit 725dc41

Please sign in to comment.