1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
--- contrib/python/Jinja2/py3/tests/conftest.py (index)
+++ contrib/python/Jinja2/py3/tests/conftest.py (working tree)
@@ -27,7 +27,8 @@ def package_loader():
@pytest.fixture
def filesystem_loader():
"""returns FileSystemLoader initialized to res/templates directory"""
- here = Path(__file__).parent.resolve()
+ import yatest.common
+ here = Path(yatest.common.test_source_path())
return loaders.FileSystemLoader(here / "res" / "templates")
--- contrib/python/Jinja2/py3/tests/test_loader.py (index)
+++ contrib/python/Jinja2/py3/tests/test_loader.py (working tree)
@@ -18,6 +18,8 @@ from jinja2._compat import PYPY
from jinja2.exceptions import TemplateNotFound
from jinja2.loaders import split_template_path
+import yatest.common as yc
+
class TestLoaders:
def test_dict_loader(self, dict_loader):
@@ -118,7 +120,7 @@ class TestLoaders(object):
class TestFileSystemLoader:
- searchpath = (Path(__file__) / ".." / "res" / "templates").resolve()
+ searchpath = (Path(yc.test_source_path()) / "res" / "templates").resolve()
@staticmethod
def _test_common(env):
@@ -146,6 +148,7 @@ class TestFileSystemLoader(object):
env = Environment(loader=filesystem_loader)
self._test_common(env)
+ @pytest.mark.skip("Arcadia read only")
def test_caches_template_based_on_mtime(self):
filesystem_loader = loaders.FileSystemLoader(self.searchpath)
@@ -316,7 +319,7 @@ def test_package_dir_list(package_dir_loader):
@pytest.fixture()
def package_file_loader(monkeypatch):
monkeypatch.syspath_prepend(Path(__file__).parent / "res")
- return PackageLoader("__init__")
+ return PackageLoader("res")
@pytest.mark.parametrize(
@@ -337,7 +340,7 @@ def test_package_dir_list(package_dir_loader):
@pytest.fixture()
def package_zip_loader(monkeypatch):
- package_zip = (Path(__file__) / ".." / "res" / "package.zip").resolve()
+ package_zip = (Path(yc.test_source_path()) / "res" / "package.zip").resolve()
monkeypatch.syspath_prepend(package_zip)
return PackageLoader("t_pack")
--- contrib/python/Jinja2/py3/tests/test_utils.py (index)
+++ contrib/python/Jinja2/py3/tests/test_utils.py (working tree)
@@ -110,7 +110,7 @@ class TestHelpers(object):
assert object_type_repr(42) == "int object"
assert object_type_repr([]) == "list object"
- assert object_type_repr(X()) == "test_utils.X object"
+ assert object_type_repr(X()) == "__tests__.test_utils.X object"
assert object_type_repr(None) == "None"
assert object_type_repr(Ellipsis) == "Ellipsis"
|