This commit is contained in:
Jacob 2023-07-26 08:57:18 +02:00 committed by GitHub
commit 093ed0fb9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 1 deletions

View file

@ -0,0 +1 @@
this is a test

View file

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import os
from pelican.tools.pelican_themes import symlink, _THEMES_PATH
from pelican.tests.support import LoggedTestCase
CURRENT_DIR_REL = os.path.dirname(__file__)
THEME_TARGET_PATH = os.path.join(_THEMES_PATH, "theme")
class TestPelicanThemes(LoggedTestCase):
# testing for pelican-themes commands.
def setUp(self):
super(TestPelicanThemes, self).setUp()
def tearDown(self):
super(TestPelicanThemes, self).tearDown()
os.remove(THEME_TARGET_PATH)
def test_symlink_relative(self):
symlink(os.path.join(CURRENT_DIR_REL, "TestTheme/theme/"))
self.assertTrue(os.path.exists(THEME_TARGET_PATH))

View file

@ -228,7 +228,7 @@ def symlink(path, v=False):
print("Linking `{p}' to `{t}' ...".format(
p=path, t=theme_path))
try:
os.symlink(path, theme_path)
os.symlink(os.path.abspath(path), theme_path)
except Exception as e:
err("Cannot link `{p}' to `{t}':\n{e}".format(
p=path, t=theme_path, e=str(e)))