2727
2828from apache_beam .io .filesystem import BeamIOError
2929from apache_beam .io .filesystem import FileMetadata
30- from apache_beam .options .pipeline_options import PipelineOptions
3130from 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
3535try :
3636 from apache_beam .io .gcp import gcsfilesystem
3737except 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' )
4956class 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