Skip to content

Commit

Permalink
Packaging: Moved tests/ and testing/ into mailpile/tests/
Browse files Browse the repository at this point in the history
  • Loading branch information
BjarniRunar committed Nov 25, 2014
1 parent 1d7ddc6 commit 99aee25
Show file tree
Hide file tree
Showing 56 changed files with 52 additions and 41 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ static/default/plugins/
*.swo
.vagrant
.coverage
testing/tmp
testing/gpg-keyring/random_seed
mailpile/tests/data/tmp
mailpile/tests/data/gpg-keyring/random_seed
ghostdriver.log
cover/
bower_components/
node_modules/
node_modules/
20 changes: 14 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ web: less js
@true

alltests: clean pytests
@chmod go-rwx testing/gpg-keyring
@chmod go-rwx mailpile/tests/data/gpg-keyring
@python2 scripts/mailpile-test.py || true
@nosetests

Expand All @@ -85,11 +85,19 @@ pytests:
@echo

clean:
@rm -f `find . -name \\*.pyc` mailpile-tmp.py mailpile.py
@rm -f `find . -name \\*.mo`
@rm -f .appver MANIFEST setup.cfg .SELF .*deps
@rm -f scripts/less-compiler.mk
@rm -rf *.egg-info build/ mp-virtualenv/ dist/ testing/tmp/
@rm -f `find . -name \\*.pyc` \
`find . -name \\*.mo` \
mailpile-tmp.py mailpile.py \
.appver MANIFEST setup.cfg .SELF .*deps \
scripts/less-compiler.mk
@rm -rf *.egg-info build/ mp-virtualenv/ dist/ \
mailpile/tests/data/tmp/ testing/tmp/

sdist: clean
@python setup.py sdist

bdist: compilemessages
@python setup.py bdist

virtualenv:
virtualenv -p python2 mp-virtualenv
Expand Down
File renamed without changes.
17 changes: 9 additions & 8 deletions tests/__init__.py → mailpile/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


def get_mailpile_root():
return os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
return os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))

TAGS = {
'New': {
Expand Down Expand Up @@ -74,15 +74,16 @@ def get_shared_mailpile():
sys.stderr.write('Preparing shared Mailpile test environment, '
'please wait. 8-)\n')

rootdir = get_mailpile_root()
datadir = os.path.join(rootdir, 'mailpile', 'tests', 'data')
gpgdir = os.path.join(datadir, 'gpg-keyring')
tmpdir = os.path.join(datadir, 'tmp')
test_data = os.path.join(datadir, 'Maildir')

# force usage of test keyring whenever the test mailpile instance is used
os.chmod(os.path.join(get_mailpile_root(), 'testing', 'gpg-keyring'),
stat.S_IRUSR|stat.S_IWUSR|stat.S_IXUSR)
os.chmod(gpgdir, stat.S_IRUSR|stat.S_IWUSR|stat.S_IXUSR)
global GNUPG_HOMEDIR
GNUPG_HOMEDIR = os.path.join(get_mailpile_root(), 'testing', 'gpg-keyring')

workdir = get_mailpile_root()
tmpdir = os.path.join(workdir, 'testing', 'tmp')
test_data = os.path.join(workdir, 'testing', 'Maildir')
GNUPG_HOMEDIR = gpgdir

if os.path.exists(tmpdir):
shutil.rmtree(tmpdir)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/gui/__init__.py → mailpile/tests/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
pass

from mailpile.httpd import HttpWorker
from tests import MailPileUnittest, get_shared_mailpile
from mailpile.tests import MailPileUnittest, get_shared_mailpile

from mailpile.safe_popen import MakePopenUnsafe

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from tests.gui import MailpileSeleniumTest
from mailpile.tests.gui import MailpileSeleniumTest


class ContactsGuiTest(MailpileSeleniumTest):
Expand Down
2 changes: 1 addition & 1 deletion tests/gui/test_mail.py → mailpile/tests/gui/test_mail.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from tests.gui import MailpileSeleniumTest
from mailpile.tests.gui import MailpileSeleniumTest


class MailGuiTest(MailpileSeleniumTest):
Expand Down
2 changes: 1 addition & 1 deletion tests/gui/test_tags.py → mailpile/tests/gui/test_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
except ImportError:
pass

from tests.gui import MailpileSeleniumTest
from mailpile.tests.gui import MailpileSeleniumTest


class TagGuiTest(MailpileSeleniumTest):
Expand Down
13 changes: 7 additions & 6 deletions tests/test_command.py → mailpile/tests/test_command.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import unittest
import mailpile
import os
from mock import patch
from mailpile.commands import Action as action

from tests import MailPileUnittest
import mailpile
from mailpile.commands import Action as action
from mailpile.tests import MailPileUnittest


class TestCommands(MailPileUnittest):
Expand Down Expand Up @@ -31,11 +32,11 @@ def test_unset(self):
self.assertEqual(results.result['stats']['count'], 3)

def test_add(self):
res = self.mp.add("tests")
res = self.mp.add("scripts")
self.assertEqual(res.as_dict()["result"], True)

def test_add_mailbox_already_in_pile(self):
res = self.mp.add("tests")
res = self.mp.add("scripts")
self.assertEqual(res.as_dict()["result"], True)

def test_add_mailbox_no_such_directory(self):
Expand Down Expand Up @@ -146,7 +147,7 @@ def test_key_receive(self):

def test_key_import(self):
res = action(self.mp._session, "crypto/gpg/importkey",
'testing/pub.key')
os.path.join('mailpile', 'tests', 'data', 'pub.key'))
self.assertEqual(res.result["results"]["count"], 1)

def test_nicknym_get_key(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_config.py → mailpile/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import mailpile

from nose.tools import raises
from tests import MailPileUnittest
from mailpile.tests import MailPileUnittest

class TestConfig(MailPileUnittest):

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from mailpile.vcard import MailpileVCard, VCardLine
from tests import MailPileUnittest
from mailpile.tests import MailPileUnittest

VCARD_CRYPTO_POLICY = 'X-MAILPILE-CRYPTO-POLICY'

Expand Down
6 changes: 3 additions & 3 deletions tests/test_eventlog.py → mailpile/tests/test_eventlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
import time

from nose.tools import raises
from tests import MailPileUnittest
from mailpile.tests import MailPileUnittest


EVENT_ID_RE = re.compile("[a-f0-9]{8}\.[a-f0-9]{5}\.[a-f0-9]+")

mailpile_root = os.path.join(os.path.dirname(__file__), "..")
mailpile_tmp = os.path.join(mailpile_root, "testing/tmp")
mailpile_root = os.path.join(os.path.dirname(__file__), "..", "..")
mailpile_tmp = os.path.join(mailpile_root, "mailpile", "tests", "data", "tmp")

class TestEventlog(MailPileUnittest):

Expand Down
4 changes: 2 additions & 2 deletions tests/test_keylookup.py → mailpile/tests/test_keylookup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from mock import patch
from tests import MailPileUnittest
import datetime

from tests import get_shared_mailpile
from mailpile.tests import MailPileUnittest
from mailpile.tests import get_shared_mailpile

from mailpile.plugins.keylookup import lookup_crypto_keys, KeyserverLookupHandler
from mailpile.plugins.keylookup.email_keylookup import *
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest
from nose.tools import assert_equal, assert_less

from tests import get_shared_mailpile, MailPileUnittest
from mailpile.tests import get_shared_mailpile, MailPileUnittest


def checkSearch(postinglist_kb, query):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_plugin.py → mailpile/tests/test_plugin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import shutil
import os
from os import path
from tests import MailPileUnittest
from mailpile.tests import MailPileUnittest
import json


Expand Down
2 changes: 1 addition & 1 deletion tests/test_search.py → mailpile/tests/test_search.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest
from nose.tools import assert_equal, assert_less

from tests import get_shared_mailpile
from mailpile.tests import get_shared_mailpile


def checkSearch(query, expected_count=1):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ui.py → mailpile/tests/test_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import mailpile
from mailpile.ui import UserInteraction

from tests import capture, MailPileUnittest
from mailpile.tests import capture, MailPileUnittest


class TestUI(MailPileUnittest):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_vcard.py → mailpile/tests/test_vcard.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest
import mailpile

from tests import MailPileUnittest
from mailpile.tests import MailPileUnittest

class TestVCard(MailPileUnittest):

Expand Down
2 changes: 1 addition & 1 deletion scripts/mailpile-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# Set up some paths
mailpile_root = os.path.join(os.path.dirname(__file__), '..')
mailpile_test = os.path.join(mailpile_root, 'testing')
mailpile_test = os.path.join(mailpile_root, 'mailpile', 'tests', 'data')
mailpile_send = os.path.join(mailpile_root, 'scripts', 'test-sendmail.sh')
mailpile_home = os.path.join(mailpile_test, 'tmp')
mailpile_gpgh = os.path.join(mailpile_test, 'gpg-keyring')
Expand Down
2 changes: 1 addition & 1 deletion scripts/test-sendmail.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
OUTPUT="$(dirname $0)/../testing/tmp/sent.mbx"
OUTPUT="$(dirname $0)/../mailpile/tests/data/tmp/sent.mbx"
mkdir -p "$(dirname $OUTPUT)"
touch "$OUTPUT"
if [ -f "$OUTPUT" ]; then
Expand Down
1 change: 1 addition & 0 deletions testing-data

0 comments on commit 99aee25

Please sign in to comment.