Skip to content

Commit

Permalink
Use copy_tree from distutils for Python <3.8 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
tomalrussell committed Feb 28, 2020
1 parent 535c20f commit 5705532
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tests/cli/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"""

import os
import shutil
import sys
from distutils.dir_util import copy_tree, remove_tree
from itertools import product
from tempfile import TemporaryDirectory
from time import sleep
Expand All @@ -17,11 +17,13 @@

@fixture
def tmp_sample_project(tmpdir_factory):
# copy sample_project folder to temporary directory, ignoring results
dst = tmpdir_factory.mktemp("smif")
"""Copy sample_project folder to temporary directory, ignoring any results
"""
dst = str(tmpdir_factory.mktemp("smif"))
src = os.path.join(os.path.dirname(smif.__file__), 'sample_project')
shutil.copytree(src, dst, ignore=lambda _dir, _contents: ['results'], dirs_exist_ok=True)
return str(dst)
copy_tree(src, dst)
remove_tree(os.path.join(dst, 'results'))
return dst


def get_args(args):
Expand Down

0 comments on commit 5705532

Please sign in to comment.