Skip to content

Commit

Permalink
test pyproject extra
Browse files Browse the repository at this point in the history
  • Loading branch information
yokomotod committed Dec 14, 2023
1 parent 19401ab commit 6ef8a91
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ s3 = ["boto3"]
gcs = ["google-api-python-client"]

[tool.pytest.ini_options]
addopts = "--strict-markers"
addopts = "--strict-markers -m 'not no_gcs and not no_s3'"
testpaths = "test"
markers = [
"gcs",
"s3",
"no_gcs",
"no_s3"
]

[tool.flake8]
Expand Down
36 changes: 36 additions & 0 deletions test/test_pyproject_extra.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import unittest

import pytest


class TestPyprojectExtra(unittest.TestCase):

@pytest.mark.gcs
def test_gcs_installed(self):
try:
import googleapiclient # noqa: F401
except ImportError:
raise Exception('googleapiclient should be installed')

@pytest.mark.no_gcs
def test_no_gcs(self):
try:
import googleapiclient # noqa: F401
raise Exception('googleapiclient should not be installed')
except ImportError:
pass

@pytest.mark.s3
def test_s3_installed(self):
try:
import boto3 # noqa: F401
except ImportError:
raise Exception('boto3 should be installed')

@pytest.mark.no_s3
def test_no_s3(self):
try:
import boto3 # noqa: F401
raise Exception('boto3 should not be installed')
except ImportError:
pass

0 comments on commit 6ef8a91

Please sign in to comment.