From 93f65d8ab9217aa3b587790415bd498f63e6d763 Mon Sep 17 00:00:00 2001 From: "John N. Milner" Date: Tue, 21 Jan 2025 17:02:22 -0500 Subject: [PATCH] Replace path.py with 2-line helper function --- setup.py | 1 - tests/test_exports.py | 11 ++++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index cf08a406..8423bb5f 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,6 @@ 'begins', 'jsonschema', 'lxml', - 'path.py', 'pyquery', 'pyxform', 'statistics', diff --git a/tests/test_exports.py b/tests/test_exports.py index 18468103..05797e0e 100644 --- a/tests/test_exports.py +++ b/tests/test_exports.py @@ -1,6 +1,9 @@ # coding: utf-8 +import contextlib import io import json +import pathlib +import tempfile import unittest from collections import OrderedDict from dateutil import parser @@ -10,7 +13,6 @@ import openpyxl import pytest -from path import TempDir from formpack import FormPack from formpack.constants import UNTRANSLATED @@ -26,6 +28,13 @@ restaurant_profile = build_fixture('restaurant_profile') +@contextlib.contextmanager +def TempDir(): + """ A small helper to avoid needing the entire path.py library """ + with tempfile.TemporaryDirectory() as d: + yield pathlib.Path(d) + + class TestFormPackExport(unittest.TestCase): maxDiff = None