From c4a0442d267009272355fb8d0c9e2dcdf118b560 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 23 Oct 2017 10:30:49 -0700 Subject: Ignore .cache dir for pytest --- .gitignore | 1 + 1 file changed, 1 insertion(+) (limited to '.gitignore') diff --git a/.gitignore b/.gitignore index 44b45974..d3e94567 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ demos/*.log !sites/docs _build .coverage +.cache -- cgit v1.2.3 From 46c1d26cb4e0827f8c860b8333c5182d8f0e0caa Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 23 Oct 2017 18:36:21 -0700 Subject: Test-related ignore updates --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.gitignore') diff --git a/.gitignore b/.gitignore index d3e94567..adce2a9f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,10 +3,10 @@ build/ dist/ .tox/ paramiko.egg-info/ -test.log docs/ demos/*.log !sites/docs _build .coverage .cache +paramiko-test-target -- cgit v1.2.3 From b4bd03f601305f825282a727c5f5d9c0b36dd94f Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 23 Oct 2017 18:43:40 -0700 Subject: Better test dir cleanup --- .gitignore | 1 - tests/conftest.py | 15 +++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) (limited to '.gitignore') diff --git a/.gitignore b/.gitignore index adce2a9f..4345d86c 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,3 @@ demos/*.log _build .coverage .cache -paramiko-test-target 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) -- cgit v1.2.3