diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2018-09-07 10:47:21 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2018-09-07 10:47:21 -0400 |
commit | c3eeca74cf935f34ed459b86ddd870bb4387f59c (patch) | |
tree | 4acafd92a3a906d94e5c3aadfb782653c800eaf6 | |
parent | f17a78c3c53953750365d68e71ed69eeaa13c34c (diff) | |
download | cherrypy-git-c3eeca74cf935f34ed459b86ddd870bb4387f59c.tar.gz |
Leverage path.py for paths in test_sessions
-rw-r--r-- | cherrypy/test/test_static.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/cherrypy/test/test_static.py b/cherrypy/test/test_static.py index 5bb74e6f..261de9d6 100644 --- a/cherrypy/test/test_static.py +++ b/cherrypy/test/test_static.py @@ -10,6 +10,7 @@ from http.client import HTTPConnection import pytest import py.path +import path import cherrypy from cherrypy.lib import static @@ -40,9 +41,9 @@ def ensure_unicode_filesystem(): tmpdir.remove() -curdir = os.path.join(os.getcwd(), os.path.dirname(__file__)) -has_space_filepath = os.path.join(curdir, 'static', 'has space.html') -bigfile_filepath = os.path.join(curdir, 'static', 'bigfile.log') +curdir = path.Path(__file__).dirname() +has_space_filepath = curdir / 'static' / 'has space.html' +bigfile_filepath = curdir / 'static' / 'bigfile.log' # The file size needs to be big enough such that half the size of it # won't be socket-buffered (or server-buffered) all in one go. See @@ -154,11 +155,7 @@ class StaticTest(helper.CPWebCase): @staticmethod def teardown_server(): for f in (has_space_filepath, bigfile_filepath): - if os.path.exists(f): - try: - os.unlink(f) - except Exception: - pass + f.remove_p() def test_static(self): self.getPage('/static/index.html') |