Skip to content

Commit

Permalink
Fix tox config and address warnings (#85)
Browse files Browse the repository at this point in the history
* Update and fix tox config, update .gitignore

* Address warnings

- use assertRaisesRegex instead of assertRaisesRegexp
- use a raw string for a regex pattern to handle escape sequences
  properly
  • Loading branch information
otargowski authored Nov 25, 2024
1 parent 844d79c commit 63af9b1
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dist

.eggs
.tox
.coverage*
.pytest_cache
.idea

Expand Down
2 changes: 1 addition & 1 deletion filetracker/servers/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@


def strip_margin(text):
return re.sub('\n[ \t]*\|', '\n', text)
return re.sub(r'\n[ \t]*\|', '\n', text)


def main(args=None):
Expand Down
6 changes: 3 additions & 3 deletions filetracker/tests/interaction_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,11 @@ def test_put_older_should_fail(self):
self.client.get_stream('/older.txt@1')

def test_get_nonexistent_should_404(self):
with self.assertRaisesRegexp(FiletrackerError, "404"):
with self.assertRaisesRegex(FiletrackerError, "404"):
self.client.get_stream('/nonexistent.txt')

def test_delete_nonexistent_should_404(self):
with self.assertRaisesRegexp(FiletrackerError, "404"):
with self.assertRaisesRegex(FiletrackerError, "404"):
self.client.delete_file('/nonexistent.txt')

def test_delete_should_remove_file_and_dir(self):
Expand All @@ -197,7 +197,7 @@ def test_delete_should_remove_file_and_dir(self):
),
)

with self.assertRaisesRegexp(FiletrackerError, "404"):
with self.assertRaisesRegex(FiletrackerError, "404"):
self.client.get_stream('/dir/del.txt')


Expand Down
2 changes: 1 addition & 1 deletion filetracker/tests/migration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def test_file_version_should_return_version_from_fallback(self):
)

def test_file_version_of_not_existent_file_should_return_404(self):
with self.assertRaisesRegexp(FiletrackerError, "404"):
with self.assertRaisesRegex(FiletrackerError, "404"):
self.client.get_stream('/nonexistent.txt')


Expand Down
10 changes: 7 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
[tox]
envlist=py27,py37
envlist = py38,py39

[testenv]
deps=pytest
pytest-cov
extras = server
deps = pytest
pytest-cov
setenv =
# Needed for systems with an AGPL-licensed Berkeley DB
YES_I_HAVE_THE_RIGHT_TO_USE_THIS_BERKELEY_DB_VERSION = 1
commands = pytest --cov=./ {posargs}

0 comments on commit 63af9b1

Please sign in to comment.