Skip to content

Commit

Permalink
Complete scaffold testing for kotti_addon.
Browse files Browse the repository at this point in the history
  • Loading branch information
disko committed Nov 22, 2014
1 parent 83639f2 commit ecae394
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 10 deletions.
3 changes: 2 additions & 1 deletion MANIFEST.in
@@ -1,6 +1,7 @@
recursive-include kotti/alembic *
recursive-include kotti/locale *
recursive-include kotti/scaffolds *
recursive-include kotti/static *
recursive-include kotti/templates *
recursive-include kotti/tests *
recursive-include kotti *.zcml
recursive-include kotti *.zcml
53 changes: 44 additions & 9 deletions kotti/tests/test_scaffolds.py
Expand Up @@ -3,7 +3,7 @@
import os
import shutil
import subprocess
from sys import stdout
import sys
from tempfile import mkdtemp

from pytest import fixture
Expand All @@ -24,28 +24,38 @@ def virtualenv(request):
# create a temp directory
cwd = os.getcwd()
virtualenv_directory = mkdtemp()
os.chdir(virtualenv_directory)

# install a virtualenv
logger = Logger([(Logger.level_for_integer(2), stdout)])
logger = Logger([(Logger.level_for_integer(2), sys.stdout)])
virtualenv.logger = logger
virtualenv.create_environment(
virtualenv_directory,
site_packages=False,
site_packages=True,
clear=False,
unzip_setuptools=True)

# chdir into the virtualenv directory
os.chdir(virtualenv_directory)

# install requirements.txt into the virtualenv
subprocess.check_call([
os.path.join(virtualenv_directory, 'bin', 'pip'),
os.path.join('bin', 'pip'),
'install', '-r',
os.path.join(cwd, 'requirements.txt')])

# setuptools-git is required to be able to call setup.py install
# sucessfully.
subprocess.check_call([
os.path.join('bin', 'pip'),
'install', 'setuptools-git'])

shutil.copytree(cwd, os.path.join(virtualenv_directory, 'kotti'))

# install Kotti into the virtualenv
os.chdir('kotti')
subprocess.check_call([
os.path.join(virtualenv_directory, 'bin', 'python'),
os.path.join(cwd, 'setup.py'),
'install'])
os.path.join('..', 'bin', 'python'), 'setup.py', 'develop'])
os.chdir('..')

def delete_virtualenv():
shutil.rmtree(virtualenv_directory)
Expand All @@ -57,5 +67,30 @@ def delete_virtualenv():
@slow
def test_scaffold_kotti_addon(virtualenv):

import pdb; pdb.set_trace()
# print available scaffolds
subprocess.check_call([os.path.join('bin', 'pcreate'), '-l'])

# set some environment variables to make pcreate non interactive
os.environ["author"] = "Kotti developers"
os.environ["email"] = "kotti@googlegroups.com"
os.environ["gh_user"] = "Kotti"

# create a project from the scaffold
subprocess.check_call([
os.path.join('bin', 'pcreate'),
'-s', 'kotti_addon', 'kotti_my_addon'])

# develop the package
os.chdir('kotti_my_addon')
subprocess.check_call([
os.path.join('..', 'bin', 'python'),
'setup.py', 'develop'])
subprocess.check_call([
os.path.join('..', 'bin', 'python'),
'setup.py', 'dev'])

# run the tests
subprocess.check_call([
os.path.join('..', 'bin', 'py.test')])

pass

0 comments on commit ecae394

Please sign in to comment.