Skip to content

Commit f02332b

Browse files
Fix GCS filesystem test gating without gcp extras
1 parent dd0563e commit f02332b

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

sdks/python/apache_beam/io/gcp/gcsfilesystem_test.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,20 @@
2727

2828
from apache_beam.io.filesystem import BeamIOError
2929
from apache_beam.io.filesystem import FileMetadata
30-
from apache_beam.options.pipeline_options import PipelineOptions
3130
from apache_beam.io.filesystems import FileSystems
31+
from apache_beam.options.pipeline_options import PipelineOptions
3232

3333
# Protect against environments where apitools library is not available.
3434
# pylint: disable=wrong-import-order, wrong-import-position
3535
try:
3636
from apache_beam.io.gcp import gcsfilesystem
3737
except ImportError:
3838
gcsfilesystem = None # type: ignore
39+
40+
try:
41+
from apache_beam.io.gcp import gcsio
42+
except ImportError:
43+
gcsio = None # type: ignore
3944
# pylint: enable=wrong-import-order, wrong-import-position
4045

4146

@@ -45,13 +50,17 @@ def test_get_filesystem_does_not_require_gcp_extra(self):
4550
self.assertEqual(fs.scheme(), 'gs')
4651

4752

48-
@unittest.skipIf(gcsfilesystem is None, 'GCP dependencies are not installed')
53+
@unittest.skipIf(
54+
gcsfilesystem is None or gcsio is None,
55+
'GCP dependencies are not installed')
4956
class GCSFileSystemTest(unittest.TestCase):
5057
def setUp(self):
58+
assert gcsfilesystem is not None
5159
pipeline_options = PipelineOptions()
5260
self.fs = gcsfilesystem.GCSFileSystem(pipeline_options=pipeline_options)
5361

5462
def test_scheme(self):
63+
assert gcsfilesystem is not None
5564
self.assertEqual(self.fs.scheme(), 'gs')
5665
self.assertEqual(gcsfilesystem.GCSFileSystem.scheme(), 'gs')
5766

0 commit comments

Comments
 (0)