|
1 | 1 | from __future__ import annotations
|
2 | 2 |
|
| 3 | +import shutil |
3 | 4 | import warnings
|
4 |
| -from shutil import which |
5 | 5 |
|
6 | 6 | import numpy as np
|
7 | 7 | import pytest
|
8 |
| -from monty.shutil import copy_r |
9 | 8 | from numpy.testing import assert_allclose
|
10 | 9 | from pytest import approx
|
11 | 10 |
|
|
15 | 14 | TEST_DIR = f"{TEST_FILES_DIR}/command_line/bader"
|
16 | 15 |
|
17 | 16 |
|
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") |
19 | 18 | class TestBaderAnalysis(MatSciTest):
|
20 | 19 | def setup_method(self):
|
21 | 20 | warnings.catch_warnings()
|
@@ -59,15 +58,15 @@ def test_init(self):
|
59 | 58 | assert len(analysis.data) == 14
|
60 | 59 |
|
61 | 60 | # 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) |
63 | 62 | analysis = BaderAnalysis(cube_filename=f"{TEST_DIR}/elec.cube.gz")
|
64 | 63 | assert len(analysis.data) == 9
|
65 | 64 |
|
66 | 65 | def test_from_path(self):
|
67 | 66 | # we need to create two copies of input files since monty decompressing files
|
68 | 67 | # 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) |
71 | 70 | chgcar_path = f"{direct_dir}/CHGCAR.gz"
|
72 | 71 | chgref_path = f"{direct_dir}/_CHGCAR_sum.gz"
|
73 | 72 |
|
|
0 commit comments