Skip to content

Commit fbdb1f3

Browse files
committed
replace monty copy_r
1 parent 72a0d05 commit fbdb1f3

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

tests/command_line/test_bader_caller.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
from __future__ import annotations
22

3+
import shutil
34
import warnings
4-
from shutil import which
55

66
import numpy as np
77
import pytest
8-
from monty.shutil import copy_r
98
from numpy.testing import assert_allclose
109
from pytest import approx
1110

@@ -15,7 +14,7 @@
1514
TEST_DIR = f"{TEST_FILES_DIR}/command_line/bader"
1615

1716

18-
@pytest.mark.skipif(not which("bader"), reason="bader executable not present")
17+
@pytest.mark.skipif(not shutil.which("bader"), reason="bader executable not present")
1918
class TestBaderAnalysis(MatSciTest):
2019
def setup_method(self):
2120
warnings.catch_warnings()
@@ -59,15 +58,15 @@ def test_init(self):
5958
assert len(analysis.data) == 14
6059

6160
# Test Cube file format parsing
62-
copy_r(TEST_DIR, self.tmp_path)
61+
shutil.copytree(TEST_DIR, self.tmp_path, dirs_exist_ok=True)
6362
analysis = BaderAnalysis(cube_filename=f"{TEST_DIR}/elec.cube.gz")
6463
assert len(analysis.data) == 9
6564

6665
def test_from_path(self):
6766
# we need to create two copies of input files since monty decompressing files
6867
# deletes the compressed version which can't happen twice in same directory
69-
copy_r(TEST_DIR, direct_dir := f"{self.tmp_path}/direct")
70-
copy_r(TEST_DIR, from_path_dir := f"{self.tmp_path}/from_path")
68+
shutil.copytree(TEST_DIR, direct_dir := f"{self.tmp_path}/direct", dirs_exist_ok=True)
69+
shutil.copytree(TEST_DIR, from_path_dir := f"{self.tmp_path}/from_path", dirs_exist_ok=True)
7170
chgcar_path = f"{direct_dir}/CHGCAR.gz"
7271
chgref_path = f"{direct_dir}/_CHGCAR_sum.gz"
7372

0 commit comments

Comments
 (0)