mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
skip tests that require git if git is not installed
and minor tweaks to subprocess handling
This commit is contained in:
parent
b10c7c699b
commit
b6a9a8333b
2 changed files with 9 additions and 3 deletions
|
|
@ -231,7 +231,8 @@ def diff_subproc(first, second):
|
||||||
['git', '--no-pager', 'diff', '--no-ext-diff', '--exit-code',
|
['git', '--no-pager', 'diff', '--no-ext-diff', '--exit-code',
|
||||||
'-w', first, second],
|
'-w', first, second],
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE
|
stderr=subprocess.PIPE,
|
||||||
|
text=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,8 @@ from pelican.tests.support import (
|
||||||
LoggedTestCase,
|
LoggedTestCase,
|
||||||
diff_subproc,
|
diff_subproc,
|
||||||
locale_available,
|
locale_available,
|
||||||
mute
|
mute,
|
||||||
|
skipIfNoExecutable,
|
||||||
)
|
)
|
||||||
|
|
||||||
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
|
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
@ -69,7 +70,8 @@ class TestPelican(LoggedTestCase):
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
msg = self._formatMessage(
|
msg = self._formatMessage(
|
||||||
msg,
|
msg,
|
||||||
"%s and %s differ:\n%s" % (left_path, right_path, err)
|
"%s and %s differ:\nstdout:\n%s\nstderr\n%s" %
|
||||||
|
(left_path, right_path, out, err)
|
||||||
)
|
)
|
||||||
raise self.failureException(msg)
|
raise self.failureException(msg)
|
||||||
|
|
||||||
|
|
@ -88,6 +90,7 @@ class TestPelican(LoggedTestCase):
|
||||||
generator_classes, Sequence,
|
generator_classes, Sequence,
|
||||||
"_get_generator_classes() must return a Sequence to preserve order")
|
"_get_generator_classes() must return a Sequence to preserve order")
|
||||||
|
|
||||||
|
@skipIfNoExecutable(['git', '--version'])
|
||||||
def test_basic_generation_works(self):
|
def test_basic_generation_works(self):
|
||||||
# when running pelican without settings, it should pick up the default
|
# when running pelican without settings, it should pick up the default
|
||||||
# ones and generate correct output without raising any exception
|
# ones and generate correct output without raising any exception
|
||||||
|
|
@ -107,6 +110,7 @@ class TestPelican(LoggedTestCase):
|
||||||
msg="Unable to find.*skipping url replacement",
|
msg="Unable to find.*skipping url replacement",
|
||||||
level=logging.WARNING)
|
level=logging.WARNING)
|
||||||
|
|
||||||
|
@skipIfNoExecutable(['git', '--version'])
|
||||||
def test_custom_generation_works(self):
|
def test_custom_generation_works(self):
|
||||||
# the same thing with a specified set of settings should work
|
# the same thing with a specified set of settings should work
|
||||||
settings = read_settings(path=SAMPLE_CONFIG, override={
|
settings = read_settings(path=SAMPLE_CONFIG, override={
|
||||||
|
|
@ -121,6 +125,7 @@ class TestPelican(LoggedTestCase):
|
||||||
self.temp_path, os.path.join(OUTPUT_PATH, 'custom')
|
self.temp_path, os.path.join(OUTPUT_PATH, 'custom')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@skipIfNoExecutable(['git', '--version'])
|
||||||
@unittest.skipUnless(locale_available('fr_FR.UTF-8') or
|
@unittest.skipUnless(locale_available('fr_FR.UTF-8') or
|
||||||
locale_available('French'), 'French locale needed')
|
locale_available('French'), 'French locale needed')
|
||||||
def test_custom_locale_generation_works(self):
|
def test_custom_locale_generation_works(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue