nixpkgs/pkgs/applications/misc/mbutil/migrate_to_pytest.patch

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
724 B
Diff
Raw Normal View History

2024-08-13 22:43:23 +00:00
diff --git a/test/test.py b/test/test.py
index e02e259..1452fda 100644
--- a/test/test.py
+++ b/test/test.py
@@ -1,13 +1,24 @@
import os, shutil
import sys
import json
-from nose import with_setup
from mbutil import mbtiles_to_disk, disk_to_mbtiles
def clear_data():
try: shutil.rmtree('test/output')
except Exception: pass
+
+def with_setup(setup_func, teardown_func):
+ def wrapper(func):
+ def wrapped(*args, **kwargs):
+ setup_func()
+ func(*args, **kwargs)
+ teardown_func()
+
+ return wrapped
+ return wrapper
+
+
@with_setup(clear_data, clear_data)
def test_mbtiles_to_disk():
mbtiles_to_disk('test/data/one_tile.mbtiles', 'test/output')