From 9c7d865e17ec16a847090a3e0d1498b698b99756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 14 Nov 2022 12:30:12 +0100 Subject: [PATCH] Drop py.code usage from tests, no longer depend on the deprecated py package --HG-- branch : py.code --- README.md | 2 +- requirements.txt | 1 - testing/cffi0/test_zintegration.py | 3 ++- testing/cffi1/test_dlopen_unicode_literals.py | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/testing/cffi0/test_zintegration.py b/testing/cffi0/test_zintegration.py index d6a02ce0..ca2d4642 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 e792866e..dc955a57 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')) -- GitLab