From: 
Subject: Debian changes

The Debian packaging of python-unasync is maintained in git, using a workflow
similar to the one described in dgit-maint-merge(7).
The Debian delta is represented by this one combined patch; there isn't a
patch queue that can be represented as a quilt series.

A detailed breakdown of the changes is available from their canonical
representation -- git commits in the packaging repository.
For example, to see the changes made by the Debian maintainer in the first
upload of upstream version 1.2.3, you could use:

    % git clone https://git.dgit.debian.org/python-unasync
    % cd python-unasync
    % git log --oneline 1.2.3..debian/1.2.3-1 -- . ':!debian'

(If you have dgit, use `dgit clone python-unasync`, rather than plain `git clone`.)

We don't use debian/source/options single-debian-patch because it has bugs.
Therefore, NMUs etc. may nevertheless have made additional patches.

---

diff --git a/tests/test_unasync.py b/tests/test_unasync.py
index 35e0c6c..c4d4c71 100644
--- a/tests/test_unasync.py
+++ b/tests/test_unasync.py
@@ -3,6 +3,7 @@ import errno
 import os
 import shutil
 import subprocess
+import sys
 
 import pytest
 
@@ -14,9 +15,22 @@ SYNC_DIR = os.path.join(TEST_DIR, "sync")
 TEST_FILES = sorted(f for f in os.listdir(ASYNC_DIR) if f.endswith(".py"))
 
 
+def env_with_unasync_on_path():
+    env = copy.copy(os.environ)
+    package_parent = os.path.dirname(os.path.dirname(os.path.abspath(unasync.__file__)))
+    pythonpath = env.get("PYTHONPATH")
+    paths = [package_parent]
+    if pythonpath:
+        paths.append(pythonpath)
+    env["PYTHONPATH"] = os.pathsep.join(paths)
+    return env
+
+
 def list_files(startpath):
     output = ""
     for root, dirs, files in os.walk(startpath):
+        dirs.sort()
+        files.sort()
         level = root.replace(startpath, "").count(os.sep)
         indent = " " * 4 * (level)
         output += f"{indent}{os.path.basename(root)}/"
@@ -69,11 +83,10 @@ def test_build_py_modules(tmpdir):
     mod_dir = str(tmpdir) + "/" + "example_mod"
     shutil.copytree(source_modules_dir, mod_dir)
 
-    env = copy.copy(os.environ)
-    env["PYTHONPATH"] = os.path.realpath(os.path.join(TEST_DIR, ".."))
-    subprocess.check_call(["python", "setup.py", "build"], cwd=mod_dir, env=env)
+    env = env_with_unasync_on_path()
+    subprocess.check_call([sys.executable, "setup.py", "build"], cwd=mod_dir, env=env)
     # Calling it twice to test the "if not copied" branch
-    subprocess.check_call(["python", "setup.py", "build"], cwd=mod_dir, env=env)
+    subprocess.check_call([sys.executable, "setup.py", "build"], cwd=mod_dir, env=env)
 
     unasynced = os.path.join(mod_dir, "build/lib/_sync/some_file.py")
     tree_build_dir = list_files(mod_dir)
@@ -89,9 +102,8 @@ def test_build_py_packages(tmpdir):
     pkg_dir = str(tmpdir) + "/" + "example_pkg"
     shutil.copytree(source_pkg_dir, pkg_dir)
 
-    env = copy.copy(os.environ)
-    env["PYTHONPATH"] = os.path.realpath(os.path.join(TEST_DIR, ".."))
-    subprocess.check_call(["python", "setup.py", "build"], cwd=pkg_dir, env=env)
+    env = env_with_unasync_on_path()
+    subprocess.check_call([sys.executable, "setup.py", "build"], cwd=pkg_dir, env=env)
 
     unasynced = os.path.join(pkg_dir, "build/lib/example_pkg/_sync/__init__.py")
 
@@ -106,9 +118,8 @@ def test_project_structure_after_build_py_packages(tmpdir):
     pkg_dir = str(tmpdir) + "/" + "example_pkg"
     shutil.copytree(source_pkg_dir, pkg_dir)
 
-    env = copy.copy(os.environ)
-    env["PYTHONPATH"] = os.path.realpath(os.path.join(TEST_DIR, ".."))
-    subprocess.check_call(["python", "setup.py", "build"], cwd=pkg_dir, env=env)
+    env = env_with_unasync_on_path()
+    subprocess.check_call([sys.executable, "setup.py", "build"], cwd=pkg_dir, env=env)
 
     _async_dir_tree = list_files(
         os.path.join(source_pkg_dir, "src/example_pkg/_async/.")
@@ -126,9 +137,8 @@ def test_project_structure_after_customized_build_py_packages(tmpdir):
     pkg_dir = str(tmpdir) + "/" + "example_custom_pkg"
     shutil.copytree(source_pkg_dir, pkg_dir)
 
-    env = copy.copy(os.environ)
-    env["PYTHONPATH"] = os.path.realpath(os.path.join(TEST_DIR, ".."))
-    subprocess.check_call(["python", "setup.py", "build"], cwd=pkg_dir, env=env)
+    env = env_with_unasync_on_path()
+    subprocess.check_call([sys.executable, "setup.py", "build"], cwd=pkg_dir, env=env)
 
     _async_dir_tree = list_files(os.path.join(source_pkg_dir, "src/ahip/."))
     unasynced_dir_path = os.path.join(pkg_dir, "build/lib/hip/.")
