Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add package python-paramiko #3311

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion SPECS/LICENSES-AND-NOTICES/LICENSES-MAP.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions SPECS/LICENSES-AND-NOTICES/data/licenses.json
Original file line number Diff line number Diff line change
Expand Up @@ -1563,6 +1563,7 @@
"python-openstackdocstheme",
"python-os-service-types",
"python-oslo-sphinx",
"python-paramiko",
"python-pexpect",
"python-pluggy",
"python-podman-api",
Expand Down
68 changes: 68 additions & 0 deletions SPECS/python-paramiko/0001-remove-pytest-relaxed-dep.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -2,7 +2,6 @@
invoke==1.6.0
invocations==2.6.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
--- a/pytest.ini
+++ b/pytest.ini
@@ -1,7 +1,4 @@
[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.
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -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
@@ -733,11 +733,11 @@ class PasswordPassphraseTests(ClientTest

# TODO: more granular exception pending #387; should be signaling "no auth
# methods available" because no key and no password
- @raises(SSHException)
@requires_sha1_signing
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 pytest.raises(SSHException):
+ # Using the "right" password in the "wrong" field shouldn't work.
+ self._test_connection(passphrase="pygmalion")

@requires_sha1_signing
def test_passphrase_kwarg_used_for_key_passphrase(self):
@@ -757,15 +757,15 @@ class PasswordPassphraseTests(ClientTest
password="television",
)

- @raises(AuthenticationException) # TODO: more granular
@requires_sha1_signing
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.
- self._test_connection(
- key_filename=_support("test_rsa_password.key"),
- password="television",
- passphrase="wat? lol no",
- )
+ with pytest.raises(AuthenticationException):
+ self._test_connection(
+ key_filename=_support("test_rsa_password.key"),
+ password="television",
+ passphrase="wat? lol no",
+ )
118 changes: 118 additions & 0 deletions SPECS/python-paramiko/0002-remove-mock-dep.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
Prefer and use built-in unittest.mock in Python 3.3+ instead
of unnecessarily requiring the external mock package. This helps
distributions that are phasing out Python 2 to remove redundant
packages.

--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -4,7 +4,7 @@ invocations==2.6.0
pytest==4.4.2
# pytest-xdist for test dir watching and the inv guard task
pytest-xdist==1.28.0
-mock==2.0.0
+mock==2.0.0;python_version<"3.3"
# Linting!
flake8==3.8.3
# Formatting!
--- a/tests/test_channelfile.py
+++ b/tests/test_channelfile.py
@@ -1,4 +1,7 @@
-from mock import patch, MagicMock
+try:
+ from unittest.mock import patch, MagicMock
+except ImportError:
+ from mock import patch, MagicMock

from paramiko import Channel, ChannelFile, ChannelStderrFile, ChannelStdinFile

--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -34,7 +34,10 @@ import weakref
from tempfile import mkstemp

import pytest
-from mock import patch, Mock
+try:
+ from unittest.mock import patch, Mock
+except ImportError:
+ from mock import patch, Mock

import paramiko
from paramiko import SSHClient
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -7,7 +7,11 @@
from paramiko.py3compat import string_types

from invoke import Result
-from mock import patch
+try:
+ from unittest.mock import patch
+except ImportError:
+ from mock import patch
+
from pytest import raises, mark, fixture

from paramiko import (

--- a/tests/test_kex.py
+++ b/tests/test_kex.py
@@ -24,7 +24,11 @@ from binascii import hexlify, unhexlify
import os
import unittest

-from mock import Mock, patch
+try:
+ from unittest.mock import Mock, patch
+except ImportError:
+ from mock import Mock, patch
+
import pytest

from cryptography.hazmat.backends import default_backend
--- a/tests/test_pkey.py
+++ b/tests/test_pkey.py
@@ -41,7 +41,12 @@ from paramiko.common import o600

from cryptography.exceptions import UnsupportedAlgorithm
from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateNumbers
-from mock import patch, Mock
+
+try:
+ from unittest.mock import patch, Mock
+except ImportError:
+ from mock import patch, Mock
+
import pytest

from .util import _support, is_low_entropy, requires_sha1_signing
--- a/tests/test_proxy.py
+++ b/tests/test_proxy.py
@@ -1,7 +1,11 @@
import signal
import socket

-from mock import patch
+try:
+ from unittest.mock import patch
+except ImportError:
+ from mock import patch
+
from pytest import raises

from paramiko import ProxyCommand, ProxyCommandFailure
--- a/tests/test_transport.py
+++ b/tests/test_transport.py
@@ -30,7 +30,11 @@ import time
import threading
import random
import unittest
-from mock import Mock
+
+try:
+ from unittest.mock import Mock
+except ImportError:
+ from mock import Mock

from paramiko import (
AuthHandler,
5 changes: 5 additions & 0 deletions SPECS/python-paramiko/python-paramiko.signatures.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"Signatures": {
"paramiko-2.11.0.tar.gz": "bccf6d3e70d99b6e80cffb234ef78447f31eb412609f8c1c4ce3d4d63020b86d"
}
}
Loading