mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
pytest.mark.serial for any test using isolated_filesystem(), refs #1406
This commit is contained in:
parent
121e10c29c
commit
2b1c535c12
3 changed files with 14 additions and 1 deletions
|
|
@ -2,7 +2,7 @@ from click.testing import CliRunner
|
||||||
from datasette import cli
|
from datasette import cli
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
import pathlib
|
import pathlib
|
||||||
import json
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
class CaptureDockerfile:
|
class CaptureDockerfile:
|
||||||
|
|
@ -24,6 +24,7 @@ CMD datasette serve --host 0.0.0.0 -i test.db --cors --inspect-file inspect-data
|
||||||
""".strip()
|
""".strip()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.serial
|
||||||
@mock.patch("shutil.which")
|
@mock.patch("shutil.which")
|
||||||
@mock.patch("datasette.cli.call")
|
@mock.patch("datasette.cli.call")
|
||||||
def test_package(mock_call, mock_which):
|
def test_package(mock_call, mock_which):
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import pytest
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.serial
|
||||||
@mock.patch("shutil.which")
|
@mock.patch("shutil.which")
|
||||||
def test_publish_cloudrun_requires_gcloud(mock_which):
|
def test_publish_cloudrun_requires_gcloud(mock_which):
|
||||||
mock_which.return_value = False
|
mock_which.return_value = False
|
||||||
|
|
@ -27,6 +28,7 @@ def test_publish_cloudrun_invalid_database(mock_which):
|
||||||
assert "Path 'woop.db' does not exist" in result.output
|
assert "Path 'woop.db' does not exist" in result.output
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.serial
|
||||||
@mock.patch("shutil.which")
|
@mock.patch("shutil.which")
|
||||||
@mock.patch("datasette.publish.cloudrun.check_output")
|
@mock.patch("datasette.publish.cloudrun.check_output")
|
||||||
@mock.patch("datasette.publish.cloudrun.check_call")
|
@mock.patch("datasette.publish.cloudrun.check_call")
|
||||||
|
|
@ -75,6 +77,7 @@ Service name: input-service
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.serial
|
||||||
@mock.patch("shutil.which")
|
@mock.patch("shutil.which")
|
||||||
@mock.patch("datasette.publish.cloudrun.check_output")
|
@mock.patch("datasette.publish.cloudrun.check_output")
|
||||||
@mock.patch("datasette.publish.cloudrun.check_call")
|
@mock.patch("datasette.publish.cloudrun.check_call")
|
||||||
|
|
@ -103,6 +106,7 @@ def test_publish_cloudrun(mock_call, mock_output, mock_which):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.serial
|
||||||
@mock.patch("shutil.which")
|
@mock.patch("shutil.which")
|
||||||
@mock.patch("datasette.publish.cloudrun.check_output")
|
@mock.patch("datasette.publish.cloudrun.check_output")
|
||||||
@mock.patch("datasette.publish.cloudrun.check_call")
|
@mock.patch("datasette.publish.cloudrun.check_call")
|
||||||
|
|
@ -147,6 +151,7 @@ def test_publish_cloudrun_memory(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.serial
|
||||||
@mock.patch("shutil.which")
|
@mock.patch("shutil.which")
|
||||||
@mock.patch("datasette.publish.cloudrun.check_output")
|
@mock.patch("datasette.publish.cloudrun.check_output")
|
||||||
@mock.patch("datasette.publish.cloudrun.check_call")
|
@mock.patch("datasette.publish.cloudrun.check_call")
|
||||||
|
|
@ -225,6 +230,7 @@ def test_publish_cloudrun_plugin_secrets(mock_call, mock_output, mock_which):
|
||||||
} == json.loads(metadata)
|
} == json.loads(metadata)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.serial
|
||||||
@mock.patch("shutil.which")
|
@mock.patch("shutil.which")
|
||||||
@mock.patch("datasette.publish.cloudrun.check_output")
|
@mock.patch("datasette.publish.cloudrun.check_output")
|
||||||
@mock.patch("datasette.publish.cloudrun.check_call")
|
@mock.patch("datasette.publish.cloudrun.check_call")
|
||||||
|
|
@ -280,6 +286,7 @@ def test_publish_cloudrun_apt_get_install(mock_call, mock_output, mock_which):
|
||||||
assert expected == dockerfile
|
assert expected == dockerfile
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.serial
|
||||||
@mock.patch("shutil.which")
|
@mock.patch("shutil.which")
|
||||||
@mock.patch("datasette.publish.cloudrun.check_output")
|
@mock.patch("datasette.publish.cloudrun.check_output")
|
||||||
@mock.patch("datasette.publish.cloudrun.check_call")
|
@mock.patch("datasette.publish.cloudrun.check_call")
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
from click.testing import CliRunner
|
from click.testing import CliRunner
|
||||||
from datasette import cli
|
from datasette import cli
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.serial
|
||||||
@mock.patch("shutil.which")
|
@mock.patch("shutil.which")
|
||||||
def test_publish_heroku_requires_heroku(mock_which):
|
def test_publish_heroku_requires_heroku(mock_which):
|
||||||
mock_which.return_value = False
|
mock_which.return_value = False
|
||||||
|
|
@ -15,6 +17,7 @@ def test_publish_heroku_requires_heroku(mock_which):
|
||||||
assert "Publishing to Heroku requires heroku" in result.output
|
assert "Publishing to Heroku requires heroku" in result.output
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.serial
|
||||||
@mock.patch("shutil.which")
|
@mock.patch("shutil.which")
|
||||||
@mock.patch("datasette.publish.heroku.check_output")
|
@mock.patch("datasette.publish.heroku.check_output")
|
||||||
@mock.patch("datasette.publish.heroku.call")
|
@mock.patch("datasette.publish.heroku.call")
|
||||||
|
|
@ -44,6 +47,7 @@ def test_publish_heroku_invalid_database(mock_which):
|
||||||
assert "Path 'woop.db' does not exist" in result.output
|
assert "Path 'woop.db' does not exist" in result.output
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.serial
|
||||||
@mock.patch("shutil.which")
|
@mock.patch("shutil.which")
|
||||||
@mock.patch("datasette.publish.heroku.check_output")
|
@mock.patch("datasette.publish.heroku.check_output")
|
||||||
@mock.patch("datasette.publish.heroku.call")
|
@mock.patch("datasette.publish.heroku.call")
|
||||||
|
|
@ -79,6 +83,7 @@ def test_publish_heroku(mock_call, mock_check_output, mock_which):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.serial
|
||||||
@mock.patch("shutil.which")
|
@mock.patch("shutil.which")
|
||||||
@mock.patch("datasette.publish.heroku.check_output")
|
@mock.patch("datasette.publish.heroku.check_output")
|
||||||
@mock.patch("datasette.publish.heroku.call")
|
@mock.patch("datasette.publish.heroku.call")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue