Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
New invariance infrastructure (2.7 + 3.5)
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Jul 2, 2016
1 parent 22fe92c commit a95dbe7
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 62 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -23,7 +23,6 @@ install:
- "if [[ $NMODE == 'nikola' ]]; then scripts/getwheelhouse.sh $(scripts/getpyver.py short); fi"
- "if [[ $NMODE == 'nikola' ]]; then pip install -r requirements-tests.txt; if [[ \"$?\" == '1' ]]; then cat /home/travis/.pip/pip.log; false; fi; fi"
- "if [[ $NMODE == 'nikola' ]]; then pip install .; fi"
- "if [[ $NMODE == 'nikola' ]]; then scripts/getbaseline.sh $(scripts/getpyver.py short); fi"
- "if [[ $NMODE == 'flake8' ]]; then pip install flake8 pep257; fi"
# We run tests and nikola (to see if the command is executable) OR flake8.
# We run `nikola` and `nikola help` because things may break due to human
Expand All @@ -34,6 +33,7 @@ script:
- "if [[ $NMODE == 'nikola' ]]; then py.test tests/; fi"
- "if [[ $NMODE == 'nikola' ]]; then nikola; fi"
- "if [[ $NMODE == 'nikola' ]]; then nikola help; fi"
- "if [[ $NMODE == 'nikola' ]]; then scripts/baseline.sh check; fi"
- "if [[ $NMODE == 'flake8' ]]; then flake8 nikola/; fi"
- "if [[ $NMODE == 'flake8' ]]; then pep257 --count --match-dir='(?!^\\\\.)(?!data).*' nikola/; fi"
after_success:
Expand Down
14 changes: 0 additions & 14 deletions scripts/getbaseline.sh

This file was deleted.

47 changes: 0 additions & 47 deletions tests/test_integration.py
Expand Up @@ -498,53 +498,6 @@ def test_subdir_run(self):
self.assertEquals(result, 0)


class InvariantBuildTest(EmptyBuildTest):
"""Test that a default build of --demo works."""

@classmethod
def build(self):
"""Build the site."""
try:
self.oldlocale = locale.getlocale()
locale.setlocale(locale.LC_ALL, ("en_US", "utf8"))
except:
pytest.skip('no en_US locale!')
else:
with cd(self.target_dir):
__main__.main(["build", "--invariant"])
finally:
try:
locale.setlocale(locale.LC_ALL, self.oldlocale)
except:
pass

@classmethod
def fill_site(self):
"""Fill the site with demo content."""
self.init_command.copy_sample_site(self.target_dir)
self.init_command.create_configuration(self.target_dir)
src1 = os.path.join(os.path.dirname(__file__), 'data', '1-nolinks.rst')
dst1 = os.path.join(self.target_dir, 'posts', '1.rst')
shutil.copy(src1, dst1)
os.system('rm "{0}/stories/creating-a-theme.rst" "{0}/stories/extending.txt" "{0}/stories/internals.txt" "{0}/stories/manual.rst" "{0}/stories/social_buttons.txt" "{0}/stories/theming.rst" "{0}/stories/path_handlers.txt" "{0}/stories/charts.txt"'.format(self.target_dir))

def test_invariance(self):
"""Compare the output to the canonical output."""
if sys.version_info[0:2] != (2, 7):
pytest.skip('only python 2.7 is supported for invariance')
good_path = os.path.join(os.path.dirname(__file__), 'data', 'baseline{0[0]}.{0[1]}'.format(sys.version_info))
if not os.path.exists(good_path):
pytest.skip('no baseline found')
with cd(self.target_dir):
try:
diff = subprocess.check_output(['diff', '-ubwr', good_path, 'output'])
self.assertEqual(diff.strip(), '')
except subprocess.CalledProcessError as exc:
print('Unexplained diff for the invariance test. (-canonical +built)')
print(exc.output.decode('utf-8'))
self.assertEqual(exc.returncode, 0, 'Unexplained diff for the invariance test.')


class RedirectionsTest1(TestCheck):
"""Check REDIRECTIONS"""

Expand Down

0 comments on commit a95dbe7

Please sign in to comment.