diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2018-09-07 10:28:27 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2018-09-07 10:33:50 -0400 |
commit | b510137cc0505debf7bb38a74f172a4071b052e5 (patch) | |
tree | dac134fc9c6b50eb923bedc102065cfed715f051 | |
parent | 52d16c40032158ab5965251bf750659b3c0f4de3 (diff) | |
download | cherrypy-git-b510137cc0505debf7bb38a74f172a4071b052e5.tar.gz |
Rely on Path object for cleaner logic
-rwxr-xr-x | cherrypy/test/test_session.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/cherrypy/test/test_session.py b/cherrypy/test/test_session.py index b8246a65..24238ecc 100755 --- a/cherrypy/test/test_session.py +++ b/cherrypy/test/test_session.py @@ -6,6 +6,7 @@ from http.client import HTTPConnection import pytest from path import Path +from more_itertools import consume import cherrypy from cherrypy._cpcompat import HTTPSConnection @@ -15,7 +16,7 @@ from cherrypy.lib.httputil import response_codes from cherrypy.test import helper from cherrypy import _json as json -localDir = os.path.dirname(__file__) +localDir = Path(__file__).dirname() def http_methods_allowed(methods=['GET', 'HEAD']): @@ -140,10 +141,13 @@ class SessionTest(helper.CPWebCase): def tearDown(self): # Clean up sessions. - for fname in os.listdir(localDir): - if fname.startswith(sessions.FileSession.SESSION_PREFIX): - path = Path(localDir) / fname - path.remove_p() + consume( + file.remove_p() + for file in localDir.listdir() + if file.basename().startswith( + sessions.FileSession.SESSION_PREFIX + ) + ) @pytest.mark.xfail(reason='#1534') def test_0_Session(self): |