* Fix python-pynacl ptest

* Fix tabs to spaces

Co-authored-by: Ubuntu <bala@ptest-1.zzv0hnfvno1ezmdplulp4pynha.bx.internal.cloudapp.net>
This commit is contained in:
Bala 2022-03-11 12:08:16 +05:30 коммит произвёл GitHub
Родитель 89d6cfd5a8
Коммит 42d7fe6f45
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 119 добавлений и 4 удалений

Просмотреть файл

@ -0,0 +1,20 @@
diff --git a/tests/test_bindings.py b/tests/test_bindings.py
index 22930cc..d7951a2 100644
--- a/tests/test_bindings.py
+++ b/tests/test_bindings.py
@@ -306,7 +306,6 @@ def test_unpad_not_padded():
@given(binary(min_size=0,
- average_size=128,
max_size=2049),
integers(min_value=16,
max_value=256)
@@ -320,7 +319,6 @@ def test_pad_sizes(msg, bl_sz):
@given(binary(min_size=0,
- average_size=128,
max_size=2049),
integers(min_value=16,
max_value=256)

Просмотреть файл

@ -0,0 +1,80 @@
From f26fc9dae2004ec812697e13d2a9aafa0e931e85 Mon Sep 17 00:00:00 2001
From: Alex Gaynor <alex.gaynor@gmail.com>
Date: Sun, 12 Jan 2020 22:15:54 -0500
Subject: [PATCH] Fix the tests
---
tests/test_aead.py | 4 ++--
tests/test_pwhash.py | 10 +++++-----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/tests/test_aead.py b/tests/test_aead.py
index 1fa32a2b..d5c58d56 100644
--- a/tests/test_aead.py
+++ b/tests/test_aead.py
@@ -18,7 +18,7 @@
import sys
from collections import namedtuple
-from hypothesis import given, settings, unlimited
+from hypothesis import given, settings
from hypothesis.strategies import binary, sampled_from
import pytest
@@ -97,7 +97,7 @@ def test_chacha20poly1305_variants_kat(kv):
max_size=b.crypto_aead_xchacha20poly1305_ietf_NPUBBYTES),
binary(min_size=b.crypto_aead_chacha20poly1305_KEYBYTES,
max_size=b.crypto_aead_chacha20poly1305_KEYBYTES))
-@settings(deadline=None, max_examples=20, timeout=unlimited)
+@settings(deadline=None, max_examples=20)
def test_chacha20poly1305_variants_roundtrip(construction,
message,
aad,
diff --git a/tests/test_pwhash.py b/tests/test_pwhash.py
index ac603665..9e53966b 100644
--- a/tests/test_pwhash.py
+++ b/tests/test_pwhash.py
@@ -20,7 +20,7 @@
import sys
import unicodedata as ud
-from hypothesis import given, settings, unlimited
+from hypothesis import given, settings
from hypothesis.strategies import integers, text
import pytest
@@ -410,7 +410,7 @@ def test_str_verify_argon2_ref_fail(password_hash, password):
integers(min_value=1024 * 1024,
max_value=16 * 1024 * 1024)
)
-@settings(deadline=None, max_examples=20, timeout=unlimited)
+@settings(deadline=None, max_examples=20)
def test_argon2i_str_and_verify(password, ops, mem):
_psw = password.encode('utf-8')
pw_hash = nacl.pwhash.argon2i.str(_psw, opslimit=ops, memlimit=mem)
@@ -424,7 +424,7 @@ def test_argon2i_str_and_verify(password, ops, mem):
integers(min_value=1024 * 1024,
max_value=16 * 1024 * 1024)
)
-@settings(deadline=None, max_examples=20, timeout=unlimited)
+@settings(deadline=None, max_examples=20)
def test_argon2id_str_and_verify(password, ops, mem):
_psw = password.encode('utf-8')
pw_hash = nacl.pwhash.argon2id.str(_psw, opslimit=ops, memlimit=mem)
@@ -438,7 +438,7 @@ def test_argon2id_str_and_verify(password, ops, mem):
integers(min_value=1024 * 1024,
max_value=16 * 1024 * 1024)
)
-@settings(deadline=None, max_examples=20, timeout=unlimited)
+@settings(deadline=None, max_examples=20)
def test_argon2i_str_and_verify_fail(password, ops, mem):
_psw = password.encode('utf-8')
pw_hash = nacl.pwhash.argon2i.str(_psw, opslimit=ops, memlimit=mem)
@@ -447,7 +447,7 @@ def test_argon2i_str_and_verify_fail(password, ops, mem):
@given(text(alphabet=PASSWD_CHARS, min_size=5, max_size=20))
-@settings(deadline=None, max_examples=5, timeout=unlimited)
+@settings(deadline=None, max_examples=5)
def test_pwhash_str_and_verify(password):
_psw = password.encode('utf-8')

Просмотреть файл

@ -1,7 +1,7 @@
Summary: PyNaCl is a Python binding to libsodium
Name: python-pynacl
Version: 1.3.0
Release: 7%{?dist}
Release: 8%{?dist}
License: ASL 2.0
Vendor: Microsoft Corporation
Distribution: Mariner
@ -10,6 +10,8 @@ URL: https://github.com/pyca/pynacl
# The official source is under https://github.com/pyca/pynacl/archive/1.3.0.tar.gz.
# Source to be fixed as part of https://microsoft.visualstudio.com/OS/_workitems/edit/25936171.
Source0: https://files.pythonhosted.org/packages/61/ab/2ac6dea8489fa713e2b4c6c5b549cc962dd4a842b5998d9e80cf8440b7cd/PyNaCl-%{version}.tar.gz
Patch1: fix_import_unlimited_error.patch
Patch2: fix_average_value_hypothesis_error.patch
%description
Good password hashing for your software and your servers.
@ -21,6 +23,15 @@ BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-six
BuildRequires: python3-xml
%if %{with_check}
BuildRequires: python3-atomicwrites
# Need newer version. Use pip3 untils pkg upgrade
#BuildRequires: python3-attrs
BuildRequires: python3-hypothesis
BuildRequires: python3-pip
BuildRequires: python3-pytest
BuildRequires: python3-wheel
%endif
Requires: python3
Requires: python3-libs
@ -28,7 +39,7 @@ Requires: python3-libs
Good password hashing for your software and your servers.
%prep
%autosetup -n PyNaCl-%{version}
%autosetup -n PyNaCl-%{version} -p1
%build
%py3_build
@ -37,8 +48,8 @@ Good password hashing for your software and your servers.
%py3_install
%check
# libsodium tests are ran as part of the build phase
%python3 setup.py test
%{python3} -m pip install pluggy more-itertools sortedcontainers attrs
PYTHONPATH=%{buildroot}%{python3_sitelib} py.test3 -v
%files -n python3-pynacl
%defattr(-,root,root)
@ -46,6 +57,10 @@ Good password hashing for your software and your servers.
%{python3_sitelib}/*
%changelog
* Thu Mar 10 2022 Bala <balakumaran.kannan@microsoft.com> - 1.3.0-8
- BR necessary packages for PTest
- Patch test cases written with older verion libraries
* Wed Oct 20 2021 Thomas Crain <thcrain@microsoft.com> - 1.3.0-7
- Add license to python3 package
- Remove python2 package