Skip to content
Snippets Groups Projects
Commit f8b45679 authored by sand's avatar sand
Browse files

update tests

parent 22e89de0
No related branches found
No related tags found
1 merge request!1Py3
...@@ -3,7 +3,6 @@ import shutil ...@@ -3,7 +3,6 @@ import shutil
import tempfile import tempfile
import unittest import unittest
import smtplib import smtplib
import gnupg
from email.mime.image import MIMEImage from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart from email.mime.multipart import MIMEMultipart
...@@ -11,8 +10,13 @@ from email.mime.text import MIMEText ...@@ -11,8 +10,13 @@ from email.mime.text import MIMEText
import pgp_mime_lib import pgp_mime_lib
import logging
logging.getLogger('gnupg').setLevel(logging.DEBUG)
logging.basicConfig()
fixtures_dir = os.path.join(os.path.dirname(__file__), 'fixtures') fixtures_dir = os.path.join(os.path.dirname(__file__), 'fixtures')
secret_key_dir = os.path.join(fixtures_dir, "gnupghome/private-keys-v1.d")
class TestBase(unittest.TestCase): class TestBase(unittest.TestCase):
...@@ -22,16 +26,15 @@ class TestBase(unittest.TestCase): ...@@ -22,16 +26,15 @@ class TestBase(unittest.TestCase):
# Load our test secret key. # Load our test secret key.
self.public_keyring = os.path.join( self.public_keyring = os.path.join(
fixtures_dir, 'secret/pubring.gpg') fixtures_dir, 'gnupghome/pubring.gpg')
self.secret_keyring = os.path.join( self.secret_key_dir = secret_key_dir
fixtures_dir, 'secret/secring.gpg')
self.secret_key = '0x56A1E35992BCB5CF' self.secret_key = '0x56A1E35992BCB5CF'
def tearDown(self): def tearDown(self):
shutil.rmtree(self.dir) shutil.rmtree(self.dir)
def _gpg(self): def _gpg(self):
return pgp_mime_lib.GPG(self.secret_key, self.public_keyring, self.secret_keyring) return pgp_mime_lib.GPG(self.secret_key, self.public_keyring, self.secret_key_dir)
class TestSign(TestBase): class TestSign(TestBase):
......
[tox] [tox]
envlist = py27 envlist = py27, py3, flake8
[testenv] [testenv]
deps= deps=
nose pytest
coverage pytest-cov
setenv =
LANG=en_US.UTF-8
GNUPG=/usr/bin/gpg
commands = commands =
/usr/bin/env LANG=en_US.UTF-8 \ # run pytest with -x --pdb to drop into pdb at the first failure
nosetests -v \ pytest --cov=pgp_mime_lib --cov-report html:htmlcov --cov-report term {posargs}
--with-coverage --cover-package=pgp_mime_lib \
--cover-erase --cover-html --cover-html-dir=htmlcov \ [testenv:flake8]
[] basepython = python3
deps =
flake8
flake8-builtins
flake8-bugbear
skip_install = true
commands = flake8 pgp_mime_lib/ setup.py
[flake8]
exclude = .tox/*, .git/*, build/*, pgp_mime_lib/_compat.py
max-line-length = 100
select =
E,F,W,C90,B,B902,C
[pytest]
norecursedirs = .tox
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment