public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/paramiko/files/, dev-python/paramiko/
Date: Thu, 16 Apr 2020 08:38:02 +0000 (UTC)	[thread overview]
Message-ID: <1587026272.cead8d25918c9c59bb84c29e978d1d96b3d20f23.mgorny@gentoo> (raw)

commit:     cead8d25918c9c59bb84c29e978d1d96b3d20f23
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 16 08:16:39 2020 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Apr 16 08:37:52 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cead8d25

dev-python/paramiko: Fix tests to work without dev-python/invoke

While at it, update the pytest_relaxed patch to match the one submitted
upstream.

Closes: https://bugs.gentoo.org/715536
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../paramiko/files/paramiko-2.7.1-tests.patch      | 108 +++++++++++++++++----
 dev-python/paramiko/paramiko-2.7.1.ebuild          |   6 +-
 2 files changed, 91 insertions(+), 23 deletions(-)

diff --git a/dev-python/paramiko/files/paramiko-2.7.1-tests.patch b/dev-python/paramiko/files/paramiko-2.7.1-tests.patch
index 9c3570c2c58..5791afd044a 100644
--- a/dev-python/paramiko/files/paramiko-2.7.1-tests.patch
+++ b/dev-python/paramiko/files/paramiko-2.7.1-tests.patch
@@ -1,26 +1,60 @@
-From e3e904cc88a08e88c9051de4f5a6f1b6e78bf4a6 Mon Sep 17 00:00:00 2001
-From: Sebastian Pipping <sebastian@pipping.org>
-Date: Mon, 16 Dec 2019 17:39:50 +0100
-Subject: [PATCH] Strip use of pytest-relaxed
+From e91cac80d679dfe16897988b0c14c1293a93c805 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Thu, 16 Apr 2020 09:22:59 +0200
+Subject: [PATCH 1/2] Replace pytest-relaxed with plain pytest.raises
 
-.. since it was removed from the tree due to breaking pytest.
+There is really no technical reason to bring pytest-relaxed to call
+@raises as a decorator while plain pytest works just fine.  Plus,
+pytest.raises() is used in test_sftp already.
+
+pytest-relaxed causes humongous breakage to other packages
+on the system.  It has been banned from Gentoo for this reason.
 ---
- tests/test_client.py | 23 +++++++++++------------
- 1 file changed, 11 insertions(+), 12 deletions(-)
+ dev-requirements.txt |  1 -
+ setup.cfg            |  3 ---
+ tests/test_client.py | 20 ++++++++++----------
+ 3 files changed, 10 insertions(+), 14 deletions(-)
 
+diff --git a/dev-requirements.txt b/dev-requirements.txt
+index f4f84748..b1b0cdf5 100644
+--- a/dev-requirements.txt
++++ b/dev-requirements.txt
+@@ -2,7 +2,6 @@
+ invoke>=1.0,<2.0
+ invocations>=1.2.0,<2.0
+ pytest==4.4.2
+-pytest-relaxed==1.1.5
+ # pytest-xdist for test dir watching and the inv guard task
+ pytest-xdist==1.28.0
+ mock==2.0.0
+diff --git a/setup.cfg b/setup.cfg
+index 44d029c4..99159096 100644
+--- a/setup.cfg
++++ b/setup.cfg
+@@ -17,9 +17,6 @@ ignore = E124,E125,E128,E261,E301,E302,E303,E402,E721,W503,E203,E722
+ max-line-length = 79
+ 
+ [tool:pytest]
+-# We use pytest-relaxed just for its utils at the moment, so disable it at the
+-# plugin level until we adapt test organization to really use it.
+-addopts = -p no:relaxed
+ # Loop on failure
+ looponfailroots = tests paramiko
+ # Ignore some warnings we cannot easily handle.
 diff --git a/tests/test_client.py b/tests/test_client.py
-index 60ad310..22a2e40 100644
+index 60ad310c..88fd1d53 100644
 --- a/tests/test_client.py
 +++ b/tests/test_client.py
-@@ -33,7 +33,6 @@ import warnings
+@@ -33,7 +33,7 @@ import warnings
  import weakref
  from tempfile import mkstemp
  
 -from pytest_relaxed import raises
++import pytest
  from mock import patch, Mock
  
  import paramiko
-@@ -684,10 +683,10 @@ class PasswordPassphraseTests(ClientTest):
+@@ -684,10 +684,10 @@ class PasswordPassphraseTests(ClientTest):
  
      # TODO: more granular exception pending #387; should be signaling "no auth
      # methods available" because no key and no password
@@ -28,13 +62,13 @@ index 60ad310..22a2e40 100644
      def test_passphrase_kwarg_not_used_for_password_auth(self):
 -        # Using the "right" password in the "wrong" field shouldn't work.
 -        self._test_connection(passphrase="pygmalion")
-+        with self.assertRaises(SSHException):
++        with pytest.raises(SSHException):
 +            # Using the "right" password in the "wrong" field shouldn't work.
 +            self._test_connection(passphrase="pygmalion")
  
      def test_passphrase_kwarg_used_for_key_passphrase(self):
          # Straightforward again, with new passphrase kwarg.
-@@ -705,14 +704,14 @@ class PasswordPassphraseTests(ClientTest):
+@@ -705,14 +705,14 @@ class PasswordPassphraseTests(ClientTest):
              password="television",
          )
  
@@ -42,21 +76,59 @@ index 60ad310..22a2e40 100644
      def test_password_kwarg_not_used_for_passphrase_when_passphrase_kwarg_given(  # noqa
          self
      ):
--        # Sanity: if we're given both fields, the password field is NOT used as
--        # a passphrase.
+         # Sanity: if we're given both fields, the password field is NOT used as
+         # a passphrase.
 -        self._test_connection(
 -            key_filename=_support("test_rsa_password.key"),
 -            password="television",
 -            passphrase="wat? lol no",
 -        )
-+        with self.assertRaises(AuthenticationException):
-+            # Sanity: if we're given both fields, the password field is NOT used as
-+            # a passphrase.
++        with pytest.raises(AuthenticationException):
 +            self._test_connection(
 +                key_filename=_support("test_rsa_password.key"),
 +                password="television",
 +                passphrase="wat? lol no",
 +            )
 -- 
-2.23.0
+2.26.1
+
+From af228a2d950654ccdd4a5d665da0018bd976c108 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Thu, 16 Apr 2020 09:46:39 +0200
+Subject: [PATCH 2/2] Skip tests requiring invoke if it's not installed
+
+Since invoke is an optional dependency and only one group of tests
+require it, skip them gracefully rather than failing if it's not
+present.
+---
+ tests/test_config.py | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/tests/test_config.py b/tests/test_config.py
+index 5e9aa059..5eeaeac3 100644
+--- a/tests/test_config.py
++++ b/tests/test_config.py
+@@ -6,7 +6,11 @@ from socket import gaierror
+ 
+ from paramiko.py3compat import string_types
+ 
+-from invoke import Result
++try:
++    from invoke import Result
++except ImportError:
++    Result = None
++
+ from mock import patch
+ from pytest import raises, mark, fixture
+ 
+@@ -705,6 +709,7 @@ def _expect(success_on):
+     return inner
+ 
+ 
++@mark.skipif(Result is None, reason='requires invoke package')
+ class TestMatchExec(object):
+     @patch("paramiko.config.invoke", new=None)
+     @patch("paramiko.config.invoke_import_error", new=ImportError("meh"))
+-- 
+2.26.1
 

diff --git a/dev-python/paramiko/paramiko-2.7.1.ebuild b/dev-python/paramiko/paramiko-2.7.1.ebuild
index 654fb81112a..114317d3687 100644
--- a/dev-python/paramiko/paramiko-2.7.1.ebuild
+++ b/dev-python/paramiko/paramiko-2.7.1.ebuild
@@ -30,11 +30,11 @@ BDEPEND="
 	dev-python/setuptools[${PYTHON_USEDEP}]
 	test? (
 		dev-python/mock[${PYTHON_USEDEP}]
-		dev-python/pytest[${PYTHON_USEDEP}]
 	)
 "
 
 distutils_enable_sphinx sites/docs
+distutils_enable_tests pytest
 
 src_prepare() {
 	eapply "${FILESDIR}"/${P}-tests.patch
@@ -46,10 +46,6 @@ src_prepare() {
 	eapply_user
 }
 
-python_test() {
-	py.test -v || die "Tests fail with ${EPYTHON}"
-}
-
 python_install_all() {
 	distutils-r1_python_install_all
 


             reply	other threads:[~2020-04-16  8:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-16  8:38 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-07-24 12:49 [gentoo-commits] repo/gentoo:master commit in: dev-python/paramiko/files/, dev-python/paramiko/ Michał Górny
2023-02-21  7:50 Michał Górny
2022-12-10  8:57 Michał Górny
2019-12-16 17:04 Sebastian Pipping
2018-01-05 13:26 Michał Górny
2016-02-26  8:37 Justin Lecher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1587026272.cead8d25918c9c59bb84c29e978d1d96b3d20f23.mgorny@gentoo \
    --to=mgorny@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox