Skip to content

Commit

Permalink
feat: update testpath to 0.6.0+dfsg-3
Browse files Browse the repository at this point in the history
  • Loading branch information
deepin-community-bot[bot] authored and deepin-ci-robot committed Jan 14, 2025
1 parent 8fc2b20 commit d9f3414
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 115 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
.pc/
__pycache__
*.pyc
/doc/_build
/MANIFEST
/build/
/dist/
.pytest_cache/
21 changes: 21 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
testpath (0.6.0+dfsg-3) unstable; urgency=medium

* Team upload.
* Fix empty binary packages (Closes: #1018279)

-- Gordon Ball <[email protected]> Mon, 29 Aug 2022 20:27:55 +0000

testpath (0.6.0+dfsg-2) unstable; urgency=medium

* Drop nose dependency.

-- Julien Puydt <[email protected]> Sat, 27 Aug 2022 12:15:10 +0200

testpath (0.6.0+dfsg-1) unstable; urgency=medium

* New upstream release.
* Update dates in d/copyright.
* Declare d/rules doesn't require root.

-- Julien Puydt <[email protected]> Thu, 10 Mar 2022 08:04:19 +0100

testpath (0.5.0+dfsg-1) unstable; urgency=medium

[ Ondřej Nový ]
Expand Down
10 changes: 8 additions & 2 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ Section: python
Priority: optional
Standards-Version: 4.6.0
Homepage: https://github.com/jupyter/testpath
Build-Depends: debhelper-compat (= 13), dh-python, python3-all, python3-sphinx,
python3-nose
Build-Depends: debhelper-compat (= 13),
dh-python,
pybuild-plugin-pyproject,
flit,
python3-all,
python3-sphinx,
python3-pytest <!nocheck>
Vcs-Git: https://salsa.debian.org/python-team/packages/testpath.git
Vcs-Browser: https://salsa.debian.org/python-team/packages/testpath
Rules-Requires-Root: no

Package: python3-testpath
Architecture: all
Expand Down
4 changes: 2 additions & 2 deletions debian/copyright
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ Upstream-Name: testpath
Files-Excluded: testpath/*.exe

Files: *
Copyright: 2015-2018 Jupyter Development Team
Copyright: 2015-2022 Jupyter Development Team
License: BSD-3-clause

Files: debian/*
Copyright: 2015-2018 Julien Puydt <[email protected]>
Copyright: 2015-2022 Julien Puydt <[email protected]>
License: BSD-3-clause

License: BSD-3-clause
Expand Down
12 changes: 1 addition & 11 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
#!/usr/bin/make -f

VERSION = $(shell PYTHONPATH=$PWD python3 -c 'import testpath; print(testpath.__version__)')

#export DH_VERBOSE=1
export PYBUILD_NAME=testpath
export PYBUILD_SYSTEM=custom
export PYBUILD_DISABLE=configure build clean
export PYBUILD_INSTALL_ARGS=mkdir -p {destdir}/usr/lib/python{version}/dist-packages/ && \
cp -R testpath {destdir}/usr/lib/python{version}/dist-packages/ && \
sed -e 's/VERSION/$(VERSION)/g' debian/testpath.egg-info > \
{destdir}/usr/lib/python{version}/dist-packages/testpath-$(VERSION).egg-info
export PYBUILD_TEST_ARGS_python3=nosetests3

%:
dh $@ --with python3,sphinxdoc --buildsystem=pybuild
dh $@ --with python3,sphinxdoc --buildsystem pybuild

override_dh_sphinxdoc:
ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS)))
Expand Down
2 changes: 1 addition & 1 deletion debian/tests/control
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Tests: runtestsuite
Depends: @, python3-nose
Depends: @, python3-pytest
2 changes: 1 addition & 1 deletion debian/tests/runtestsuite
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
set -e
nosetests3 2>/dev/null
pytest 2>/dev/null
12 changes: 10 additions & 2 deletions doc/history.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
Release notes
=============

0.6
---

February 2022

* Removed some code that's unused since dropping Python 2 support.
* Relax the version constraint for the ``flit_core`` build requirement.

0.5
---

May 2021

* Easier ways to use :class:`.MockCommand` to customise mocked commands,
including ``python=`` to specify extra code to run,
:meth:`~.MockCommand.fixed_output`, and :meth:`~.MockCommand.assert_called`.
* Command mocking will use :data:`os.defpath` as the initial PATH if the PATH
environment variable is not set.

May 2021
1 change: 0 additions & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

4 changes: 2 additions & 2 deletions doc/tempdir.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Utilities for temporary directories

.. module:: testpath.tempdir

This module exposes :func:`tempfile.TemporaryDirectory`, with a backported copy
so that it can be used on Python 2. In addition, it contains:
The :mod:`testpath.tempdir` module contains a couple of utilities for working
with temporary directories:

.. autoclass:: NamedFileInTemporaryDirectory

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["flit_core >=3.2.0,<3.3"]
requires = ["flit_core >=3.2.0,<4"]
build-backend = "flit_core.buildapi"

[project]
Expand All @@ -19,7 +19,7 @@ classifiers = [
dynamic = ["version", "description"]

[project.optional-dependencies]
test = ["pytest", "pathlib2; python_version == \"2.7\""]
test = ["pytest"]

[project.urls]
Documentation = "https://testpath.readthedocs.io/en/latest/"
Expand Down
2 changes: 1 addition & 1 deletion testpath/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
from .env import temporary_env, modified_env, make_env_restorer
from .commands import MockCommand, assert_calls

__version__ = '0.5.0'
__version__ = '0.6.0'
91 changes: 2 additions & 89 deletions testpath/tempdir.py
Original file line number Diff line number Diff line change
@@ -1,99 +1,12 @@
"""TemporaryDirectory class, copied from Python 3
"""Extra utilities for temporary directories.
NamedFileInTemporaryDirectory and TemporaryWorkingDirectory from IPython, which
uses the 3-clause BSD license.
"""
from __future__ import print_function

import os as _os
import warnings as _warnings
import sys as _sys

# This code should only be used in Python versions < 3.2, since after that we
# can rely on the stdlib itself.
try:
from tempfile import TemporaryDirectory

except ImportError:
from tempfile import mkdtemp, template

class TemporaryDirectory(object):
"""Create and return a temporary directory. This has the same
behavior as mkdtemp but can be used as a context manager. For
example:
with TemporaryDirectory() as tmpdir:
...
Upon exiting the context, the directory and everything contained
in it are removed.
"""

def __init__(self, suffix="", prefix=template, dir=None):
self.name = mkdtemp(suffix, prefix, dir)
self._closed = False

def __enter__(self):
return self.name

def cleanup(self, _warn=False):
if self.name and not self._closed:
try:
self._rmtree(self.name)
except (TypeError, AttributeError) as ex:
# Issue #10188: Emit a warning on stderr
# if the directory could not be cleaned
# up due to missing globals
if "None" not in str(ex):
raise
print("ERROR: {!r} while cleaning up {!r}".format(ex, self,),
file=_sys.stderr)
return
self._closed = True
if _warn:
self._warn("Implicitly cleaning up {!r}".format(self),
Warning)

def __exit__(self, exc, value, tb):
self.cleanup()

def __del__(self):
# Issue a ResourceWarning if implicit cleanup needed
self.cleanup(_warn=True)


# XXX (ncoghlan): The following code attempts to make
# this class tolerant of the module nulling out process
# that happens during CPython interpreter shutdown
# Alas, it doesn't actually manage it. See issue #10188
_listdir = staticmethod(_os.listdir)
_path_join = staticmethod(_os.path.join)
_isdir = staticmethod(_os.path.isdir)
_remove = staticmethod(_os.remove)
_rmdir = staticmethod(_os.rmdir)
_os_error = _os.error
_warn = _warnings.warn

def _rmtree(self, path):
# Essentially a stripped down version of shutil.rmtree. We can't
# use globals because they may be None'ed out at shutdown.
for name in self._listdir(path):
fullname = self._path_join(path, name)
try:
isdir = self._isdir(fullname)
except self._os_error:
isdir = False
if isdir:
self._rmtree(fullname)
else:
try:
self._remove(fullname)
except self._os_error:
pass
try:
self._rmdir(path)
except self._os_error:
pass
from tempfile import TemporaryDirectory


class NamedFileInTemporaryDirectory(object):
Expand Down

0 comments on commit d9f3414

Please sign in to comment.