FEDX-121 The previous approach for handling NPM assets was to symlink them into the static directory. This appeared to cause trouble with the asset pipeline where the files in question were not installed and then old versions were picked up instead. This change instead copies NPM libraries to a new static directory so that the pipeline can consume them as with any other file. This new directory is added to .gitignore so that the files don't get accidentally checked in.
61 lines
1.6 KiB
Python
61 lines
1.6 KiB
Python
"""Unit tests for the Paver server tasks."""
|
|
|
|
import os
|
|
from paver import tasks
|
|
from unittest import TestCase
|
|
|
|
|
|
class PaverTestCase(TestCase):
|
|
"""
|
|
Base class for Paver test cases.
|
|
"""
|
|
def setUp(self):
|
|
super(PaverTestCase, self).setUp()
|
|
|
|
# Show full length diffs upon test failure
|
|
self.maxDiff = None # pylint: disable=invalid-name
|
|
|
|
# Create a mock Paver environment
|
|
tasks.environment = MockEnvironment()
|
|
|
|
# Don't run pre-reqs
|
|
os.environ['NO_PREREQ_INSTALL'] = 'true'
|
|
|
|
def tearDown(self):
|
|
super(PaverTestCase, self).tearDown()
|
|
tasks.environment = tasks.Environment()
|
|
del os.environ['NO_PREREQ_INSTALL']
|
|
|
|
@property
|
|
def task_messages(self):
|
|
"""Returns the messages output by the Paver task."""
|
|
return tasks.environment.messages
|
|
|
|
@property
|
|
def platform_root(self):
|
|
"""Returns the current platform's root directory."""
|
|
return os.getcwd()
|
|
|
|
def reset_task_messages(self):
|
|
"""Clear the recorded message"""
|
|
tasks.environment.messages = []
|
|
|
|
|
|
class MockEnvironment(tasks.Environment):
|
|
"""
|
|
Mock environment that collects information about Paver commands.
|
|
"""
|
|
def __init__(self):
|
|
super(MockEnvironment, self).__init__()
|
|
self.dry_run = True
|
|
self.messages = []
|
|
|
|
def info(self, message, *args):
|
|
"""Capture any messages that have been recorded"""
|
|
if args:
|
|
output = message % args
|
|
else:
|
|
output = message
|
|
if not output.startswith("--->"):
|
|
self.messages.append(unicode(output))
|