Commit f8b45679 authored by sand's avatar sand

update tests

parent 22e89de0
......@@ -3,7 +3,6 @@ import shutil
import tempfile
import unittest
import smtplib
import gnupg
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
......@@ -11,8 +10,13 @@ from email.mime.text import MIMEText
import pgp_mime_lib
import logging
logging.getLogger('gnupg').setLevel(logging.DEBUG)
logging.basicConfig()
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):
......@@ -22,16 +26,15 @@ class TestBase(unittest.TestCase):
# Load our test secret key.
self.public_keyring = os.path.join(
fixtures_dir, 'secret/pubring.gpg')
self.secret_keyring = os.path.join(
fixtures_dir, 'secret/secring.gpg')
fixtures_dir, 'gnupghome/pubring.gpg')
self.secret_key_dir = secret_key_dir
self.secret_key = '0x56A1E35992BCB5CF'
def tearDown(self):
shutil.rmtree(self.dir)
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):
......
[tox]
envlist = py27
envlist = py27, py3, flake8
[testenv]
deps=
nose
coverage
commands=
/usr/bin/env LANG=en_US.UTF-8 \
nosetests -v \
--with-coverage --cover-package=pgp_mime_lib \
--cover-erase --cover-html --cover-html-dir=htmlcov \
[]
pytest
pytest-cov
setenv =
LANG=en_US.UTF-8
GNUPG=/usr/bin/gpg
commands =
# run pytest with -x --pdb to drop into pdb at the first failure
pytest --cov=pgp_mime_lib --cov-report html:htmlcov --cov-report term {posargs}
[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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment