diff --git a/tests/tabix_test.py b/tests/tabix_test.py
index <HASH>..<HASH> 100644
--- a/tests/tabix_test.py
+++ b/tests/tabix_test.py
@@ -78,6 +78,15 @@ class TestIndexing(unittest.TestCase):
         pysam.tabix_index(self.tmpfilename, preset="gff")
         self.assertTrue(checkBinaryEqual(self.tmpfilename + ".tbi", self.filename_idx))
 
+    def test_indexing_to_custom_location_works(self):
+        '''test indexing a file with a non-default location.'''
+
+        index_path = get_temp_filename(suffix='custom.tbi')
+        pysam.tabix_index(self.tmpfilename, preset="gff", index=index_path, force=True)
+        self.assertTrue(checkBinaryEqual(index_path, self.filename_idx))
+        os.unlink(index_path)
+
+
     def test_indexing_with_explict_columns_works(self):
         '''test indexing via preset.'''
 
@@ -101,7 +110,8 @@ class TestIndexing(unittest.TestCase):
         
     def tearDown(self):
         os.unlink(self.tmpfilename)
-        os.unlink(self.tmpfilename + ".tbi")
+        if os.path.exists(self.tmpfilename + ".tbi"):
+            os.unlink(self.tmpfilename + ".tbi")
 
 
 class TestCompression(unittest.TestCase):
Add test for indexing tabix file to custom location