summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2017-10-23 18:43:40 -0700
committerJeff Forcier <jeff@bitprophet.org>2018-09-17 14:45:32 -0700
commitb4bd03f601305f825282a727c5f5d9c0b36dd94f (patch)
tree53965ae4d88720c52de3b56b7bc4e4098b253d9f /tests
parent1daf054fb158135dfd9dcf71002406f19625b71f (diff)
Better test dir cleanup
Diffstat (limited to 'tests')
-rw-r--r--tests/conftest.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index f77c929f..ac83eacf 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -25,7 +25,7 @@ logging.basicConfig(
)
-def make_sftp_folder(client):
+def make_sftp_folder():
"""
Ensure expected target temp folder exists on the remote end.
@@ -43,8 +43,7 @@ def make_sftp_folder(client):
path = os.environ.get('TEST_FOLDER', 'paramiko-test-target')
# Forcibly nuke this directory locally, since at the moment, the below
# fixtures only ever run with a locally scoped stub test server.
- if os.path.exists(path):
- shutil.rmtree(path)
+ shutil.rmtree(path, ignore_errors=True)
# Then create it anew, again locally, for the same reason.
os.mkdir(path)
return path
@@ -94,12 +93,8 @@ def sftp(sftp_server):
# TODO: how cleanest to make this available to tests? Doing it this way is
# marginally less bad than the previous 'global'-using setup, but not by
# much?
- client.FOLDER = make_sftp_folder(client)
+ client.FOLDER = make_sftp_folder()
# Yield client to caller
yield client
- # Clean up
- # TODO: many SFTP tests like to close the client; to match old test suite
- # behavior we'd need to recreate the entire client? Possibly better to just
- # make the "it runs locally, dumbass" explicit & then just use stdlib to
- # clean up?
- #client.rmdir(client.FOLDER)
+ # Clean up - as in make_sftp_folder, we assume local-only exec for now.
+ shutil.rmtree(client.FOLDER, ignore_errors=True)