Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: python
python:
- "3.6"
- "3.7"
- "3.8"
- "3.12"
- "3.13"
- "3.14"
install: "pip install -r travis-requirements.txt"
script: nosetests
script: pytest
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ ENV DEB_BUILD_OPTIONS=${opts}
RUN apt-get update -qq -o Acquire::Languages=none \
&& env DEBIAN_FRONTEND=noninteractive apt-get install \
-yqq --no-install-recommends -o Dpkg::Options::=--force-unsafe-io \
build-essential debhelper devscripts equivs lsb-release libparse-debianchangelog-perl \
build-essential debhelper devscripts equivs lsb-release \
python3 python3-setuptools python3-pip python3-dev \
python3-sphinx python3-mock dh-exec dh-python python3-sphinx-rtd-theme \
python3-sphinx dh-exec dh-python python3-sphinx-rtd-theme \
&& if test "$(lsb_release -cs)" = 'bionic' ; then \
apt-get install -yqq --no-install-recommends -o Dpkg::Options::=--force-unsafe-io \
-t bionic-backports debhelper; fi \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ In the new sequence, `dh_virtualenv` is inserted right before `dh_installinit`.

## Running tests

$ nosetests ./test/test_deployment.py
$ pytest ./test/test_deployment.py


## Building the package in a Docker container
Expand Down
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Section: python
Priority: optional
Maintainer: Jyrki Pulliainen <[email protected]>
Build-Depends: debhelper-compat (= 12), python3,
python3-setuptools, python3-sphinx, python3-mock, dh-exec,
python3-setuptools, python3-sphinx, dh-exec,
dh-python, libjs-jquery, libjs-underscore,
# python-sphinx-rtd-theme doesn't exist in distributions
# predating Debian Jessie and Ubuntu Xenial. On these legacy
Expand Down
4 changes: 2 additions & 2 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ override_dh_gencontrol:

ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS)))
override_dh_installdocs:
python3 setup.py build_sphinx
dh_installdocs doc/_build/html
sphinx-build -b html doc doc/_build
dh_installdocs doc/_build
endif
6 changes: 3 additions & 3 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

# Developer tooling
pip-upgrader
invoke==0.13.0
rituals==0.4.1
invoke==2.2.1
rituals==0.4.2
#https://github.com/jhermann/rituals/archive/master.zip#egg=rituals

# CI tooling
-r travis-requirements.txt

# Sphinx basics are in Travis requirements
sphinx-autobuild==0.7.1
sphinx-autobuild==2025.8.25

# Add project itself
-e .
349 changes: 349 additions & 0 deletions doc/LICENSE.rst

Large diffs are not rendered by default.

34 changes: 20 additions & 14 deletions doc/api/dh_virtualenv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,33 @@ dh\_virtualenv package
======================

.. automodule:: dh_virtualenv
:members:
:undoc-members:
:show-inheritance:
:members:
:show-inheritance:
:undoc-members:

Submodules
----------

dh\_virtualenv\.cmdline module
------------------------------
dh\_virtualenv.cmdline module
-----------------------------

.. automodule:: dh_virtualenv.cmdline
:members:
:undoc-members:
:show-inheritance:
:members:
:show-inheritance:
:undoc-members:

dh\_virtualenv\.deployment module
---------------------------------
dh\_virtualenv.debhelper module
-------------------------------

.. automodule:: dh_virtualenv.deployment
:members:
:undoc-members:
:show-inheritance:
.. automodule:: dh_virtualenv.debhelper
:members:
:show-inheritance:
:undoc-members:

dh\_virtualenv.deployment module
--------------------------------

.. automodule:: dh_virtualenv.deployment
:members:
:show-inheritance:
:undoc-members:
7 changes: 0 additions & 7 deletions setup.cfg

This file was deleted.

47 changes: 23 additions & 24 deletions test/test_cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
import warnings

from dh_virtualenv import cmdline
from mock import patch
from nose.tools import eq_, ok_
from unittest.mock import patch


def get_mocked_stderr():
Expand All @@ -42,38 +41,38 @@ def get_mocked_stderr():
def test_unknown_argument_is_error(error_mock):
parser = cmdline.DebhelperOptionParser(usage='foo')
parser.parse_args(['-f'])
eq_(1, error_mock.call_count)
assert 1 == error_mock.call_count


def test_test_debhelper_option_parsing():
parser = cmdline.DebhelperOptionParser()
parser.add_option('--sourcedirectory')
opts, args = parser.parse_args(['-O--sourcedirectory', '/tmp'])
eq_('/tmp', opts.sourcedirectory)
eq_([], args)
assert '/tmp' == opts.sourcedirectory
assert [] == args


def test_ignore_unknown_debhelper_options():
parser = cmdline.DebhelperOptionParser()
parser.add_option('-O')
opts, args = parser.parse_args(['-O--buildsystem=none'])
eq_([], args)
assert [] == args


def test_parser_picks_up_DH_OPTIONS_from_environ():
with patch.dict(os.environ, {'DH_OPTIONS': '--sourcedirectory=/tmp/'}):
parser = cmdline.get_default_parser()
opts, args = parser.parse_args()
eq_('/tmp/', opts.sourcedirectory)
assert '/tmp/' == opts.sourcedirectory

def test_get_default_parser():
parser = cmdline.get_default_parser()
opts, args = parser.parse_args([
'-O--sourcedirectory', '/tmp/foo',
'--extra-index-url', 'http://example.com'
])
eq_('/tmp/foo', opts.sourcedirectory)
eq_(['http://example.com'], opts.extra_index_url)
assert '/tmp/foo' == opts.sourcedirectory
assert ['http://example.com'] == opts.extra_index_url


def test_pypi_url_creates_deprecation_warning():
Expand All @@ -86,9 +85,9 @@ def test_pypi_url_creates_deprecation_warning():
parser.parse_args([
'--pypi-url=http://example.com',
])
eq_(len(w), 1)
ok_(issubclass(w[0].category, DeprecationWarning))
eq_(str(w[0].message), 'Use of --pypi-url is deprecated. Use --index-url instead')
assert len(w) == 1
assert issubclass(w[0].category, DeprecationWarning)
assert str(w[0].message) == 'Use of --pypi-url is deprecated. Use --index-url instead'


def test_no_test_creates_deprecation_warning():
Expand All @@ -97,9 +96,9 @@ def test_no_test_creates_deprecation_warning():
parser.parse_args([
'--no-test',
])
eq_(len(w), 1)
ok_(issubclass(w[0].category, DeprecationWarning))
eq_(str(w[0].message),
assert len(w) == 1
assert issubclass(w[0].category, DeprecationWarning)
assert (str(w[0].message) ==
'Use of --no-test is deprecated and has no effect. '
'Use --setuptools-test if you want to execute '
'`setup.py test` during package build.')
Expand All @@ -114,7 +113,7 @@ def test_pypi_url_index_url_conflict(exit_):
'--pypi-url=http://example.com',
'--index-url=http://example.org']
)
ok_('Deprecated --pypi-url and the new --index-url are mutually exclusive'
assert ('Deprecated --pypi-url and the new --index-url are mutually exclusive'
in f.getvalue())
exit_.assert_called_once_with(2)

Expand All @@ -128,7 +127,7 @@ def test_test_flag_conflict(exit_):
'--no-test',
'--setuptools-test']
)
ok_('Deprecated --no-test and the new --setuptools-test are mutually '
assert ('Deprecated --no-test and the new --setuptools-test are mutually '
'exclusive'
in f.getvalue())
exit_.assert_called_once_with(2)
Expand All @@ -143,39 +142,39 @@ def test_pypi_url_index_url_conflict_independent_from_order(exit_):
'--index-url=http://example.org',
'--pypi-url=http://example.com']
)
ok_('Deprecated --pypi-url and the new --index-url are mutually exclusive'
assert ('Deprecated --pypi-url and the new --index-url are mutually exclusive'
in f.getvalue())
exit_.assert_called_once_with(2)


def test_that_default_test_option_should_be_false():
parser = cmdline.get_default_parser()
opts, args = parser.parse_args()
eq_(False, opts.setuptools_test)
assert False == opts.setuptools_test


def test_that_test_option_can_be_true():
parser = cmdline.get_default_parser()
opts, args = parser.parse_args(['--setuptools-test'])
eq_(True, opts.setuptools_test)
assert True == opts.setuptools_test


def test_that_no_test_option_has_no_effect():
parser = cmdline.get_default_parser()
opts, args = parser.parse_args(['--no-test'])
eq_(False, opts.setuptools_test)
assert False == opts.setuptools_test


def test_that_default_use_system_packages_option_should_be_false():
parser = cmdline.get_default_parser()
opts, args = parser.parse_args()
eq_(False, opts.use_system_packages)
assert False == opts.use_system_packages


def test_that_use_system_packages_option_can_be_true():
parser = cmdline.get_default_parser()
opts, args = parser.parse_args(['--use-system-packages'])
eq_(True, opts.use_system_packages)
assert True == opts.use_system_packages


def test_builtin_venv_and_setuptools_conflict():
Expand All @@ -190,5 +189,5 @@ def test_builtin_venv_and_setuptools_conflict():
with patch('sys.stderr', f), patch('sys.exit') as sysexit:
parser = cmdline.get_default_parser()
parser.parse_args(args)
ok_(error_message in f.getvalue())
assert error_message in f.getvalue()
sysexit.assert_called_once_with(2)
Loading