Merge branch '2.11.x'

This commit is contained in:
David Lord 2020-02-05 20:39:04 -08:00
commit e08dadd220
No known key found for this signature in database
GPG Key ID: 7A1C87E3F5BC42A8
16 changed files with 0 additions and 111 deletions

View File

@ -13,50 +13,6 @@ def pytest_ignore_collect(path):
return False
def pytest_configure(config):
"""Register custom marks for test categories."""
custom_markers = [
"api",
"byte_code_cache",
"core_tags",
"debug",
"escapeUrlizeTarget",
"ext",
"extended",
"filesystemloader",
"filter",
"for_loop",
"helpers",
"if_condition",
"imports",
"includes",
"inheritance",
"lexer",
"lexnparse",
"loaders",
"loremIpsum",
"lowlevel",
"lrucache",
"lstripblocks",
"macros",
"meta",
"moduleloader",
"parser",
"regression",
"sandbox",
"set",
"streaming",
"syntax",
"test_tests",
"tokenstream",
"undefined",
"utils",
"with_",
]
for mark in custom_markers:
config.addinivalue_line("markers", mark + ": test category")
@pytest.fixture
def env():
"""returns a new environment."""

View File

@ -24,8 +24,6 @@ from jinja2.utils import environmentfunction
from jinja2.utils import evalcontextfunction
@pytest.mark.api
@pytest.mark.extended
class TestExtendedAPI:
def test_item_and_attribute(self, env):
from jinja2.sandbox import SandboxedEnvironment
@ -161,8 +159,6 @@ class TestExtendedAPI:
t.render(total=MAX_RANGE + 1)
@pytest.mark.api
@pytest.mark.meta
class TestMeta:
def test_find_undeclared_variables(self, env):
ast = env.parse("{% set foo = 42 %}{{ bar + foo }}")
@ -216,8 +212,6 @@ class TestMeta:
assert list(i) == ["foo.html", "bar.html", None]
@pytest.mark.api
@pytest.mark.streaming
class TestStreaming:
def test_basic_streaming(self, env):
t = env.from_string(
@ -259,8 +253,6 @@ class TestStreaming:
shutil.rmtree(tmp)
@pytest.mark.api
@pytest.mark.undefined
class TestUndefined:
def test_stopiteration_is_undefined(self):
def test():
@ -396,8 +388,6 @@ class TestUndefined:
Undefined(obj=42, name="upper")()
@pytest.mark.api
@pytest.mark.lowlevel
class TestLowLevel:
def test_custom_code_generator(self):
class CustomCodeGenerator(CodeGenerator):

View File

@ -130,7 +130,6 @@ def test_env_async():
return env
@pytest.mark.imports
class TestAsyncImports:
def test_context_imports(self, test_env_async):
t = test_env_async.from_string('{% import "module" as m %}{{ m.test() }}')
@ -180,8 +179,6 @@ class TestAsyncImports:
assert not hasattr(m, "notthere")
@pytest.mark.imports
@pytest.mark.includes
class TestAsyncIncludes:
def test_context_include(self, test_env_async):
t = test_env_async.from_string('{% include "header" %}')
@ -279,8 +276,6 @@ class TestAsyncIncludes:
assert t.render().strip() == "(FOO)"
@pytest.mark.core_tags
@pytest.mark.for_loop
class TestAsyncForLoop:
def test_simple(self, test_env_async):
tmpl = test_env_async.from_string("{% for item in seq %}{{ item }}{% endfor %}")

View File

@ -13,7 +13,6 @@ def env(package_loader, tmp_path):
return Environment(loader=package_loader, bytecode_cache=bytecode_cache)
@pytest.mark.byte_code_cache
class TestByteCodeCache:
def test_simple(self, env):
tmpl = env.get_template("test.html")

View File

@ -12,8 +12,6 @@ def env_trim():
return Environment(trim_blocks=True)
@pytest.mark.core_tags
@pytest.mark.for_loop
class TestForLoop:
def test_simple(self, env):
tmpl = env.from_string("{% for item in seq %}{{ item }}{% endfor %}")
@ -300,8 +298,6 @@ class TestForLoop:
assert tmpl.render(x=0, seq=[1, 2, 3]) == "919293"
@pytest.mark.core_tags
@pytest.mark.if_condition
class TestIfCondition:
def test_simple(self, env):
tmpl = env.from_string("""{% if true %}...{% endif %}""")
@ -342,8 +338,6 @@ class TestIfCondition:
assert tmpl.render() == "1"
@pytest.mark.core_tags
@pytest.mark.macros
class TestMacros:
def test_simple(self, env_trim):
tmpl = env_trim.from_string(
@ -468,8 +462,6 @@ class TestMacros:
assert tmpl.module.m(1, x=7) == "1|7|7"
@pytest.mark.core_tags
@pytest.mark.set
class TestSet:
def test_normal(self, env_trim):
tmpl = env_trim.from_string("{% set foo = 1 %}{{ foo }}")
@ -577,8 +569,6 @@ class TestSet:
assert tmpl.module.foo == "11"
@pytest.mark.core_tags
@pytest.mark.with_
class TestWith:
def test_with(self, env):
tmpl = env.from_string(

View File

@ -16,7 +16,6 @@ def fs_env(filesystem_loader):
return Environment(loader=filesystem_loader)
@pytest.mark.debug
class TestDebug:
def assert_traceback_matches(self, callback, expected_tb):
with pytest.raises(Exception) as exc_info:

View File

@ -160,7 +160,6 @@ class StreamFilterExtension(Extension):
yield Token(lineno, "data", token.value[pos:])
@pytest.mark.ext
class TestExtensions:
def test_extend_late(self):
env = Environment()
@ -260,7 +259,6 @@ class TestExtensions:
assert f"'{value}'" in out
@pytest.mark.ext
class TestInternationalization:
def test_trans(self):
tmpl = i18n_env.get_template("child.html")
@ -403,7 +401,6 @@ class TestInternationalization:
]
@pytest.mark.ext
class TestScope:
def test_basic_scope_behavior(self):
# This is what the old with statement compiled down to
@ -437,7 +434,6 @@ class TestScope:
assert tmpl.render(b=3, e=4) == "1|2|2|4|5"
@pytest.mark.ext
class TestNewstyleInternationalization:
def test_trans(self):
tmpl = newstyle_i18n_env.get_template("child.html")
@ -529,7 +525,6 @@ class TestNewstyleInternationalization:
assert t.render() == "%(foo)s"
@pytest.mark.ext
class TestAutoEscape:
def test_scoped_setting(self):
env = Environment(extensions=["jinja2.ext.autoescape"], autoescape=True)

View File

@ -24,7 +24,6 @@ class Magic2:
return f"({self.value1},{self.value2})"
@pytest.mark.filter
class TestFilter:
def test_filter_calling(self, env):
rv = env.call_filter("sum", [1, 2, 3])

View File

@ -23,7 +23,6 @@ def test_env():
return env
@pytest.mark.imports
class TestImports:
def test_context_imports(self, test_env):
t = test_env.from_string('{% import "module" as m %}{{ m.test() }}')
@ -100,8 +99,6 @@ class TestImports:
t.render()
@pytest.mark.imports
@pytest.mark.includes
class TestIncludes:
def test_context_include(self, test_env):
t = test_env.from_string('{% include "header" %}')

View File

@ -73,7 +73,6 @@ def env():
)
@pytest.mark.inheritance
class TestInheritance:
def test_layout(self, env):
tmpl = env.get_template("layout")
@ -232,7 +231,6 @@ class TestInheritance:
assert rv == ["43", "44", "45"]
@pytest.mark.inheritance
class TestBugFix:
def test_fixed_macro_scoping_bug(self, env):
assert (

View File

@ -12,8 +12,6 @@ from jinja2.lexer import TOKEN_EOF
from jinja2.lexer import TokenStream
@pytest.mark.lexnparse
@pytest.mark.tokenstream
class TestTokenStream:
test_tokens = [
Token(1, TOKEN_BLOCK_BEGIN, ""),
@ -42,8 +40,6 @@ class TestTokenStream:
]
@pytest.mark.lexnparse
@pytest.mark.lexer
class TestLexer:
def test_raw1(self, env):
tmpl = env.from_string(
@ -168,8 +164,6 @@ class TestLexer:
pytest.raises(TemplateSyntaxError, env.from_string, t)
@pytest.mark.lexnparse
@pytest.mark.parser
class TestParser:
def test_php_syntax(self, env):
env = Environment("<?", "?>", "<?=", "?>", "<!--", "-->")
@ -303,8 +297,6 @@ and bar comment #}
assert_error("{% unknown_tag %}", "Encountered unknown tag 'unknown_tag'.")
@pytest.mark.lexnparse
@pytest.mark.syntax
class TestSyntax:
def test_call(self, env):
env = Environment()
@ -559,8 +551,6 @@ class TestSyntax:
assert tmpl.render(foo={"bar": 42}) == "42"
@pytest.mark.lexnparse
@pytest.mark.lstripblocks
class TestLstripBlocks:
def test_lstrip(self, env):
env = Environment(lstrip_blocks=True, trim_blocks=False)

View File

@ -15,7 +15,6 @@ from jinja2.exceptions import TemplateNotFound
from jinja2.loaders import split_template_path
@pytest.mark.loaders
class TestLoaders:
def test_dict_loader(self, dict_loader):
env = Environment(loader=dict_loader)
@ -115,8 +114,6 @@ class TestLoaders:
pytest.raises(TemplateNotFound, split_template_path, "../foo")
@pytest.mark.loaders
@pytest.mark.filesystemloader
class TestFileSystemLoader:
searchpath = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "res", "templates"
@ -178,8 +175,6 @@ class TestFileSystemLoader:
assert t.render() == expect
@pytest.mark.loaders
@pytest.mark.moduleloader
class TestModuleLoader:
archive = None

View File

@ -9,7 +9,6 @@ from jinja2 import TemplateNotFound
from jinja2 import TemplateSyntaxError
@pytest.mark.regression
class TestCorner:
def test_assigned_scoping(self, env):
t = env.from_string(
@ -81,7 +80,6 @@ class TestCorner:
assert t.render(wrapper=23) == "[1][2][3][4]23"
@pytest.mark.regression
class TestBug:
def test_keyword_folding(self, env):
env = Environment()

View File

@ -34,7 +34,6 @@ class PublicStuff:
return "PublicStuff"
@pytest.mark.sandbox
class TestSandbox:
def test_unsafe(self, env):
env = SandboxedEnvironment()
@ -126,7 +125,6 @@ class TestSandbox:
t.render(ctx)
@pytest.mark.sandbox
class TestStringFormat:
def test_basic_format_safety(self):
env = SandboxedEnvironment()
@ -149,7 +147,6 @@ class TestStringFormat:
assert t.render() == "a42b&lt;foo&gt;"
@pytest.mark.sandbox
class TestStringFormatMap:
def test_basic_format_safety(self):
env = SandboxedEnvironment()

View File

@ -8,7 +8,6 @@ class MyDict(dict):
pass
@pytest.mark.test_tests
class TestTestsCase:
def test_defined(self, env):
tmpl = env.from_string("{{ missing is defined }}|{{ true is defined }}")

View File

@ -15,8 +15,6 @@ from jinja2.utils import select_autoescape
from jinja2.utils import urlize
@pytest.mark.utils
@pytest.mark.lrucache
class TestLRUCache:
def test_simple(self):
d = LRUCache(3)
@ -110,8 +108,6 @@ class TestLRUCache:
assert len(d) == 2
@pytest.mark.utils
@pytest.mark.helpers
class TestHelpers:
def test_object_type_repr(self):
class X:
@ -140,8 +136,6 @@ class TestHelpers:
assert not func("FOO.TXT")
@pytest.mark.utils
@pytest.mark.escapeUrlizeTarget
class TestEscapeUrlizeTarget:
def test_escape_urlize_target(self):
url = "http://example.org"
@ -153,8 +147,6 @@ class TestEscapeUrlizeTarget:
)
@pytest.mark.utils
@pytest.mark.loremIpsum
class TestLoremIpsum:
def test_lorem_ipsum_markup(self):
"""Test that output of lorem_ipsum is Markup by default."""