summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorMiro Hrončok <miro@hroncok.cz>2022-11-14 12:30:12 +0100
committerMiro Hrončok <miro@hroncok.cz>2022-11-14 12:30:12 +0100
commit96e5108f5d7c68f46dcd23f8e03878b1e94c395f (patch)
tree4eaa0eada31353035cc1c4f2150f84fe8e01469c /testing
parentea92abe896f3763205bd281a40824b89746bebb3 (diff)
downloadcffi-96e5108f5d7c68f46dcd23f8e03878b1e94c395f.tar.gz
Drop py.code usage from tests, no longer depend on the deprecated py package
Diffstat (limited to 'testing')
-rw-r--r--testing/cffi0/test_zintegration.py3
-rw-r--r--testing/cffi1/test_dlopen_unicode_literals.py4
2 files changed, 4 insertions, 3 deletions
diff --git a/testing/cffi0/test_zintegration.py b/testing/cffi0/test_zintegration.py
index d6a02ce..ca2d464 100644
--- a/testing/cffi0/test_zintegration.py
+++ b/testing/cffi0/test_zintegration.py
@@ -1,5 +1,6 @@
import py, os, sys, shutil
import subprocess
+import textwrap
from testing.udir import udir
import pytest
@@ -66,7 +67,7 @@ def really_run_setup_and_program(dirname, venv_dir_and_paths, python_snippet):
remove(os.path.join(basedir, '__pycache__'))
olddir = os.getcwd()
python_f = udir.join('x.py')
- python_f.write(py.code.Source(python_snippet))
+ python_f.write(textwrap.dedent(python_snippet))
try:
os.chdir(str(SNIPPET_DIR.join(dirname)))
if os.name == 'nt':
diff --git a/testing/cffi1/test_dlopen_unicode_literals.py b/testing/cffi1/test_dlopen_unicode_literals.py
index e792866..dc955a5 100644
--- a/testing/cffi1/test_dlopen_unicode_literals.py
+++ b/testing/cffi1/test_dlopen_unicode_literals.py
@@ -1,4 +1,4 @@
-import py, os
+import os
s = """from __future__ import unicode_literals
"""
@@ -6,4 +6,4 @@ s = """from __future__ import unicode_literals
with open(os.path.join(os.path.dirname(__file__), 'test_dlopen.py')) as f:
s += f.read()
-exec(py.code.compile(s))
+exec(compile(s, filename='test_dlopen.py', mode='exec'))