File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed
Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -54,11 +54,13 @@ s3 = ["boto3"]
5454gcs = [" google-api-python-client" ]
5555
5656[tool .pytest .ini_options ]
57- addopts = " --strict-markers"
57+ addopts = " --strict-markers -m 'not no_gcs and not no_s3' "
5858testpaths = " test"
5959markers = [
6060 " gcs" ,
6161 " s3" ,
62+ " no_gcs" ,
63+ " no_s3"
6264]
6365
6466[tool .flake8 ]
Original file line number Diff line number Diff line change 1+ import unittest
2+
3+ import pytest
4+
5+
6+ class TestPyprojectExtra (unittest .TestCase ):
7+
8+ @pytest .mark .gcs
9+ def test_gcs_installed (self ):
10+ try :
11+ import googleapiclient # noqa: F401
12+ except ImportError :
13+ raise Exception ('googleapiclient should be installed' )
14+
15+ @pytest .mark .no_gcs
16+ def test_no_gcs (self ):
17+ try :
18+ import googleapiclient # noqa: F401
19+ raise Exception ('googleapiclient should not be installed' )
20+ except ImportError :
21+ pass
22+
23+ @pytest .mark .s3
24+ def test_s3_installed (self ):
25+ try :
26+ import boto3 # noqa: F401
27+ except ImportError :
28+ raise Exception ('boto3 should be installed' )
29+
30+ @pytest .mark .no_s3
31+ def test_no_s3 (self ):
32+ try :
33+ import boto3 # noqa: F401
34+ raise Exception ('boto3 should not be installed' )
35+ except ImportError :
36+ pass
You can’t perform that action at this time.
0 commit comments