From 4793fd598d525d6f2a6d8597d6de3ac8de2496e5 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Mon, 17 Jun 2024 03:10:44 -0500 Subject: [PATCH] fix: Use shutil.copytree over setuptools._distutils * As setuptools is not the build backend there should be no reliance on setuptools or distutils for use. This exchanges setuptools._distutils.dir_util.copy_tree for shutil.copytree as pyhf supports Python 3.8+. --- tests/conftest.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index ad2d9d7cba..c62ee21acd 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,10 +1,10 @@ import json import pathlib +import shutil import sys import tarfile import pytest -from setuptools._distutils import dir_util import pyhf @@ -164,9 +164,6 @@ def datadir(tmp_path, request): test_dir = pathlib.Path(request.module.__file__).with_suffix('') if test_dir.is_dir(): - dir_util.copy_tree(test_dir, str(tmp_path)) - # shutil is nicer, but doesn't work: https://bugs.python.org/issue20849 - # Once pyhf is Python 3.8+ only then the below can be used. - # shutil.copytree(test_dir, tmp_path) + shutil.copytree(test_dir, tmp_path) return tmp_path