From: David Lord Date: Thu, 6 Feb 2020 04:23:47 +0000 (-0800) Subject: remove custom pytest marks X-Git-Tag: 2.11.2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd5a0508c5e938b2660d6b1a74a2af6ff1a65dd5;p=thirdparty%2Fjinja.git remove custom pytest marks --- diff --git a/tests/conftest.py b/tests/conftest.py index bb26409a..23088a33 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -14,50 +14,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.""" diff --git a/tests/test_api.py b/tests/test_api.py index 0c262dc4..058ec56c 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -25,8 +25,6 @@ from jinja2.utils import environmentfunction from jinja2.utils import evalcontextfunction -@pytest.mark.api -@pytest.mark.extended class TestExtendedAPI(object): def test_item_and_attribute(self, env): from jinja2.sandbox import SandboxedEnvironment @@ -163,8 +161,6 @@ class TestExtendedAPI(object): t.render(total=MAX_RANGE + 1) -@pytest.mark.api -@pytest.mark.meta class TestMeta(object): def test_find_undeclared_variables(self, env): ast = env.parse("{% set foo = 42 %}{{ bar + foo }}") @@ -218,8 +214,6 @@ class TestMeta(object): assert list(i) == ["foo.html", "bar.html", None] -@pytest.mark.api -@pytest.mark.streaming class TestStreaming(object): def test_basic_streaming(self, env): t = env.from_string( @@ -261,8 +255,6 @@ class TestStreaming(object): shutil.rmtree(tmp) -@pytest.mark.api -@pytest.mark.undefined class TestUndefined(object): def test_stopiteration_is_undefined(self): def test(): @@ -400,8 +392,6 @@ class TestUndefined(object): Undefined(obj=42, name="upper")() -@pytest.mark.api -@pytest.mark.lowlevel class TestLowLevel(object): def test_custom_code_generator(self): class CustomCodeGenerator(CodeGenerator): diff --git a/tests/test_async.py b/tests/test_async.py index d6c4a239..11efd849 100644 --- a/tests/test_async.py +++ b/tests/test_async.py @@ -130,7 +130,6 @@ def test_env_async(): return env -@pytest.mark.imports class TestAsyncImports(object): 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(object): assert not hasattr(m, "notthere") -@pytest.mark.imports -@pytest.mark.includes class TestAsyncIncludes(object): def test_context_include(self, test_env_async): t = test_env_async.from_string('{% include "header" %}') @@ -279,8 +276,6 @@ class TestAsyncIncludes(object): assert t.render().strip() == "(FOO)" -@pytest.mark.core_tags -@pytest.mark.for_loop class TestAsyncForLoop(object): def test_simple(self, test_env_async): tmpl = test_env_async.from_string("{% for item in seq %}{{ item }}{% endfor %}") diff --git a/tests/test_bytecode_cache.py b/tests/test_bytecode_cache.py index 2970cb5c..c7882b1a 100644 --- a/tests/test_bytecode_cache.py +++ b/tests/test_bytecode_cache.py @@ -14,7 +14,6 @@ def env(package_loader, tmp_path): return Environment(loader=package_loader, bytecode_cache=bytecode_cache) -@pytest.mark.byte_code_cache class TestByteCodeCache(object): def test_simple(self, env): tmpl = env.get_template("test.html") diff --git a/tests/test_core_tags.py b/tests/test_core_tags.py index 4132c4f5..1bd96c41 100644 --- a/tests/test_core_tags.py +++ b/tests/test_core_tags.py @@ -13,8 +13,6 @@ def env_trim(): return Environment(trim_blocks=True) -@pytest.mark.core_tags -@pytest.mark.for_loop class TestForLoop(object): def test_simple(self, env): tmpl = env.from_string("{% for item in seq %}{{ item }}{% endfor %}") @@ -305,8 +303,6 @@ class TestForLoop(object): assert tmpl.render(x=0, seq=[1, 2, 3]) == "919293" -@pytest.mark.core_tags -@pytest.mark.if_condition class TestIfCondition(object): def test_simple(self, env): tmpl = env.from_string("""{% if true %}...{% endif %}""") @@ -349,8 +345,6 @@ class TestIfCondition(object): assert tmpl.render() == "1" -@pytest.mark.core_tags -@pytest.mark.macros class TestMacros(object): def test_simple(self, env_trim): tmpl = env_trim.from_string( @@ -475,8 +469,6 @@ class TestMacros(object): assert tmpl.module.m(1, x=7) == "1|7|7" -@pytest.mark.core_tags -@pytest.mark.set class TestSet(object): def test_normal(self, env_trim): tmpl = env_trim.from_string("{% set foo = 1 %}{{ foo }}") @@ -584,8 +576,6 @@ class TestSet(object): assert tmpl.module.foo == u"11" -@pytest.mark.core_tags -@pytest.mark.with_ class TestWith(object): def test_with(self, env): tmpl = env.from_string( diff --git a/tests/test_debug.py b/tests/test_debug.py index 5ca92d92..284b9e91 100644 --- a/tests/test_debug.py +++ b/tests/test_debug.py @@ -17,7 +17,6 @@ def fs_env(filesystem_loader): return Environment(loader=filesystem_loader) -@pytest.mark.debug class TestDebug(object): def assert_traceback_matches(self, callback, expected_tb): with pytest.raises(Exception) as exc_info: diff --git a/tests/test_ext.py b/tests/test_ext.py index 67d2cdb5..8e4b411e 100644 --- a/tests/test_ext.py +++ b/tests/test_ext.py @@ -167,7 +167,6 @@ class StreamFilterExtension(Extension): yield Token(lineno, "data", token.value[pos:]) -@pytest.mark.ext class TestExtensions(object): def test_extend_late(self): env = Environment() @@ -267,7 +266,6 @@ class TestExtensions(object): assert "'{}'".format(value) in out -@pytest.mark.ext class TestInternationalization(object): def test_trans(self): tmpl = i18n_env.get_template("child.html") @@ -418,7 +416,6 @@ class TestInternationalization(object): ] -@pytest.mark.ext class TestScope(object): def test_basic_scope_behavior(self): # This is what the old with statement compiled down to @@ -452,7 +449,6 @@ class TestScope(object): assert tmpl.render(b=3, e=4) == "1|2|2|4|5" -@pytest.mark.ext class TestNewstyleInternationalization(object): def test_trans(self): tmpl = newstyle_i18n_env.get_template("child.html") @@ -544,7 +540,6 @@ class TestNewstyleInternationalization(object): assert t.render() == "%(foo)s" -@pytest.mark.ext class TestAutoEscape(object): def test_scoped_setting(self): env = Environment(extensions=["jinja2.ext.autoescape"], autoescape=True) diff --git a/tests/test_filters.py b/tests/test_filters.py index 109f4441..37dde44d 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -29,7 +29,6 @@ class Magic2(object): return u"(%s,%s)" % (text_type(self.value1), text_type(self.value2)) -@pytest.mark.filter class TestFilter(object): def test_filter_calling(self, env): rv = env.call_filter("sum", [1, 2, 3]) diff --git a/tests/test_imports.py b/tests/test_imports.py index 0dae2173..fad2edaf 100644 --- a/tests/test_imports.py +++ b/tests/test_imports.py @@ -23,7 +23,6 @@ def test_env(): return env -@pytest.mark.imports class TestImports(object): def test_context_imports(self, test_env): t = test_env.from_string('{% import "module" as m %}{{ m.test() }}') @@ -94,8 +93,6 @@ class TestImports(object): assert not hasattr(m, "notthere") -@pytest.mark.imports -@pytest.mark.includes class TestIncludes(object): def test_context_include(self, test_env): t = test_env.from_string('{% include "header" %}') diff --git a/tests/test_inheritance.py b/tests/test_inheritance.py index 92f66e04..e513d2e3 100644 --- a/tests/test_inheritance.py +++ b/tests/test_inheritance.py @@ -74,7 +74,6 @@ def env(): ) -@pytest.mark.inheritance class TestInheritance(object): def test_layout(self, env): tmpl = env.get_template("layout") @@ -233,7 +232,6 @@ class TestInheritance(object): assert rv == ["43", "44", "45"] -@pytest.mark.inheritance class TestBugFix(object): def test_fixed_macro_scoping_bug(self, env): assert ( diff --git a/tests/test_lexnparse.py b/tests/test_lexnparse.py index 9da93805..e799acdc 100644 --- a/tests/test_lexnparse.py +++ b/tests/test_lexnparse.py @@ -27,8 +27,6 @@ else: jinja_string_repr = repr -@pytest.mark.lexnparse -@pytest.mark.tokenstream class TestTokenStream(object): test_tokens = [ Token(1, TOKEN_BLOCK_BEGIN, ""), @@ -57,8 +55,6 @@ class TestTokenStream(object): ] -@pytest.mark.lexnparse -@pytest.mark.lexer class TestLexer(object): def test_raw1(self, env): tmpl = env.from_string( @@ -183,8 +179,6 @@ class TestLexer(object): pytest.raises(TemplateSyntaxError, env.from_string, t) -@pytest.mark.lexnparse -@pytest.mark.parser class TestParser(object): def test_php_syntax(self, env): env = Environment("", "", "") @@ -318,8 +312,6 @@ and bar comment #} assert_error("{% unknown_tag %}", "Encountered unknown tag 'unknown_tag'.") -@pytest.mark.lexnparse -@pytest.mark.syntax class TestSyntax(object): def test_call(self, env): env = Environment() @@ -575,8 +567,6 @@ class TestSyntax(object): assert tmpl.render(foo={"bar": 42}) == "42" -@pytest.mark.lexnparse -@pytest.mark.lstripblocks class TestLstripBlocks(object): def test_lstrip(self, env): env = Environment(lstrip_blocks=True, trim_blocks=False) diff --git a/tests/test_loader.py b/tests/test_loader.py index 4aa6511e..71e00b25 100644 --- a/tests/test_loader.py +++ b/tests/test_loader.py @@ -17,7 +17,6 @@ from jinja2.exceptions import TemplateNotFound from jinja2.loaders import split_template_path -@pytest.mark.loaders class TestLoaders(object): def test_dict_loader(self, dict_loader): env = Environment(loader=dict_loader) @@ -117,8 +116,6 @@ class TestLoaders(object): pytest.raises(TemplateNotFound, split_template_path, "../foo") -@pytest.mark.loaders -@pytest.mark.filesystemloader class TestFileSystemLoader(object): searchpath = os.path.join( os.path.dirname(os.path.abspath(__file__)), "res", "templates" @@ -186,8 +183,6 @@ class TestFileSystemLoader(object): assert t.render() == expect -@pytest.mark.loaders -@pytest.mark.moduleloader class TestModuleLoader(object): archive = None diff --git a/tests/test_regression.py b/tests/test_regression.py index accc1f62..c5a0d680 100644 --- a/tests/test_regression.py +++ b/tests/test_regression.py @@ -13,7 +13,6 @@ from jinja2 import TemplateSyntaxError from jinja2._compat import text_type -@pytest.mark.regression class TestCorner(object): def test_assigned_scoping(self, env): t = env.from_string( @@ -85,7 +84,6 @@ class TestCorner(object): assert t.render(wrapper=23) == "[1][2][3][4]23" -@pytest.mark.regression class TestBug(object): def test_keyword_folding(self, env): env = Environment() diff --git a/tests/test_security.py b/tests/test_security.py index f092c96d..7e8974c8 100644 --- a/tests/test_security.py +++ b/tests/test_security.py @@ -37,7 +37,6 @@ class PublicStuff(object): return "PublicStuff" -@pytest.mark.sandbox class TestSandbox(object): def test_unsafe(self, env): env = SandboxedEnvironment() @@ -167,7 +166,6 @@ class TestSandbox(object): t.render(ctx) -@pytest.mark.sandbox class TestStringFormat(object): def test_basic_format_safety(self): env = SandboxedEnvironment() @@ -190,7 +188,6 @@ class TestStringFormat(object): assert t.render() == "a42b<foo>" -@pytest.mark.sandbox @pytest.mark.skipif( not hasattr(str, "format_map"), reason="requires str.format_map method" ) diff --git a/tests/test_tests.py b/tests/test_tests.py index 42595e8f..b903e3b1 100644 --- a/tests/test_tests.py +++ b/tests/test_tests.py @@ -9,7 +9,6 @@ class MyDict(dict): pass -@pytest.mark.test_tests class TestTestsCase(object): def test_defined(self, env): tmpl = env.from_string("{{ missing is defined }}|{{ true is defined }}") diff --git a/tests/test_utils.py b/tests/test_utils.py index 58165efb..b379a97a 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -18,8 +18,6 @@ from jinja2.utils import select_autoescape from jinja2.utils import urlize -@pytest.mark.utils -@pytest.mark.lrucache class TestLRUCache(object): def test_simple(self): d = LRUCache(3) @@ -120,8 +118,6 @@ class TestLRUCache(object): assert len(d) == 2 -@pytest.mark.utils -@pytest.mark.helpers class TestHelpers(object): def test_object_type_repr(self): class X(object): @@ -150,8 +146,6 @@ class TestHelpers(object): assert not func("FOO.TXT") -@pytest.mark.utils -@pytest.mark.escapeUrlizeTarget class TestEscapeUrlizeTarget(object): def test_escape_urlize_target(self): url = "http://example.org" @@ -163,8 +157,6 @@ class TestEscapeUrlizeTarget(object): ) -@pytest.mark.utils -@pytest.mark.loremIpsum class TestLoremIpsum(object): def test_lorem_ipsum_markup(self): """Test that output of lorem_ipsum is Markup by default."""