piranna / pyfilesystem

Automatically exported from code.google.com/p/pyfilesystem
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

it should skip tests for extensions that aren't importable (patch included) #99

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. run tests on a platform that doesn't have boto
2. see errors
3.

What is the expected output? What do you see instead?

I expect it to say "I couldn't run these tests, since boto is not installed." 
instead I see it say "There is an error!"

What version of the product are you using? On what operating system?

svn trunk, linux

Please provide any additional information below.

Permission is hereby granted to any person obtaining a copy of this work to
deal in this work without restriction (including the rights to use, modify,
distribute, sublicense, and/or sell copies).

HACK zompu:~/playground/pyfilesystem/pyfilesystem-read-only$ svn diff
Index: fs/tests/test_s3fs.py
===================================================================
--- fs/tests/test_s3fs.py       (revision 723)
+++ fs/tests/test_s3fs.py       (working copy)
@@ -11,9 +11,15 @@
 import unittest

 from fs.tests import FSTestCases, ThreadingTestCases
-from fs.path import *
+# from fs.path import *

-from fs import s3fs
+s3fs = None
+try:
+    from fs import s3fs
+except ImportError:
+    pass
+
+
 class TestS3FS(unittest.TestCase,FSTestCases,ThreadingTestCases):

     #  Disable the tests by default
@@ -22,6 +28,8 @@
     bucket = "test-s3fs.rfk.id.au"

     def setUp(self):
+        if s3fs is None:
+            raise unittest.SkipTest("s3fs wasn't importable")
         self.fs = s3fs.S3FS(self.bucket)
         for k in self.fs._s3bukt.list():
             self.fs._s3bukt.delete_key(k)
@@ -45,6 +53,8 @@
 class TestS3FS_prefix(TestS3FS):

     def setUp(self):
+        if s3fs is None:
+            raise unittest.SkipTest("s3fs wasn't importable")
         self.fs = s3fs.S3FS(self.bucket,"/unittest/files")
         for k in self.fs._s3bukt.list():
             self.fs._s3bukt.delete_key(k)

Original issue reported on code.google.com by zoo...@gmail.com on 8 Dec 2011 at 1:32

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by willmcgugan on 9 Sep 2013 at 8:39