unittests: Fix warning about distutils deprecation

unittests/rewritetests.py:19: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  from distutils.dir_util import copy_tree
pull/9907/head
Nirbheek Chauhan 3 years ago committed by Nirbheek Chauhan
parent 2512c25c0b
commit 19684d23e8
  1. 7
      unittests/rewritetests.py

@ -15,9 +15,10 @@
import subprocess import subprocess
import json import json
import os import os
import shutil
import unittest import unittest
from distutils.dir_util import copy_tree
from mesonbuild.mesonlib import windows_proof_rmtree
from .baseplatformtests import BasePlatformTests from .baseplatformtests import BasePlatformTests
class RewriterTests(BasePlatformTests): class RewriterTests(BasePlatformTests):
@ -26,7 +27,9 @@ class RewriterTests(BasePlatformTests):
self.maxDiff = None self.maxDiff = None
def prime(self, dirname): def prime(self, dirname):
copy_tree(os.path.join(self.rewrite_test_dir, dirname), self.builddir) if os.path.exists(self.builddir):
windows_proof_rmtree(self.builddir)
shutil.copytree(os.path.join(self.rewrite_test_dir, dirname), self.builddir)
def rewrite_raw(self, directory, args): def rewrite_raw(self, directory, args):
if isinstance(args, str): if isinstance(args, str):

Loading…
Cancel
Save