Skip to content

Commit

Permalink
Merge pull request #429 from spotify/travis-osx
Browse files Browse the repository at this point in the history
naive attempt at adding os x
  • Loading branch information
Erik Bernhardsson authored Sep 30, 2019
2 parents 8adb8e9 + 375e047 commit 7acd413
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 20 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ matrix:
env:
- TOXENV=py36
- python: 3.7
dist: xenial
env:
- TOXENV=py37
- os: osx
language: generic
env:
- TOXENV=py36

env:
matrix:
Expand Down
24 changes: 5 additions & 19 deletions test/index_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,25 +185,11 @@ def test_write_failed(self):
t.add_item(i, v)
t.build(10)

if sys.platform == "linux" or sys.platform == "linux2":
# linux
try:
t.save("/dev/full")
self.fail("didn't get expected exception")
except Exception as e:
self.assertTrue('No space left on device' in str(e))
elif sys.platform == "darwin":
volume = "FULLDISK"
device = os.popen('hdiutil attach -nomount ram://64').read()
os.popen('diskutil erasevolume MS-DOS %s %s' % (volume, device))
os.popen('touch "/Volumes/%s/full"' % volume)
try:
t.save('/Volumes/%s/annoy.tree' % volume)
self.fail("didn't get expected exception")
except Exception as e:
self.assertTrue('No space left on device' in str(e))
finally:
os.popen("hdiutil detach %s" % device)
if os.name == 'nt':
path = 'Z:\\xyz.annoy'
else:
path = '/x/y/z.annoy'
self.assertRaises(Exception, t.save, path)

def test_dimension_mismatch(self):
t = AnnoyIndex(100, 'angular')
Expand Down

0 comments on commit 7acd413

Please sign in to comment.