forked from orbit-oss/flask
Merge remote-tracking branch 'origin/2.1.x'
This commit is contained in:
commit
1888df3440
8 changed files with 53 additions and 48 deletions
|
|
@ -18,7 +18,6 @@ from flask import current_app
|
|||
from flask import Flask
|
||||
from flask.cli import AppGroup
|
||||
from flask.cli import DispatchingApp
|
||||
from flask.cli import dotenv
|
||||
from flask.cli import find_best_app
|
||||
from flask.cli import FlaskGroup
|
||||
from flask.cli import get_version
|
||||
|
|
@ -492,7 +491,18 @@ class TestRoutes:
|
|||
assert "No routes were registered." in result.output
|
||||
|
||||
|
||||
need_dotenv = pytest.mark.skipif(dotenv is None, reason="dotenv is not installed")
|
||||
def dotenv_not_available():
|
||||
try:
|
||||
import dotenv # noqa: F401
|
||||
except ImportError:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
need_dotenv = pytest.mark.skipif(
|
||||
dotenv_not_available(), reason="dotenv is not installed"
|
||||
)
|
||||
|
||||
|
||||
@need_dotenv
|
||||
|
|
@ -530,7 +540,7 @@ def test_dotenv_path(monkeypatch):
|
|||
|
||||
|
||||
def test_dotenv_optional(monkeypatch):
|
||||
monkeypatch.setattr("flask.cli.dotenv", None)
|
||||
monkeypatch.setitem(sys.modules, "dotenv", None)
|
||||
monkeypatch.chdir(test_path)
|
||||
load_dotenv()
|
||||
assert "FOO" not in os.environ
|
||||
|
|
@ -602,7 +612,8 @@ def test_run_cert_import(monkeypatch):
|
|||
|
||||
|
||||
def test_run_cert_no_ssl(monkeypatch):
|
||||
monkeypatch.setattr("flask.cli.ssl", None)
|
||||
monkeypatch.setitem(sys.modules, "ssl", None)
|
||||
|
||||
with pytest.raises(click.BadParameter):
|
||||
run_command.make_context("run", ["--cert", "not_here"])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue