mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Replace os.sep.join with the more robust os.path.join
From the Python docs for os.sep [1]: Note that knowing this is not sufficient to be able to parse or concatenate pathnames - use os.path.split() and os.path.join()... Where I touched a line, I also changed double quoted string literals to single quotes, since they are used more often in the source: wking@mjolnir ~/src/pelican $ git grep "'" pelican/*.py | wc -l 683 wking@mjolnir ~/src/pelican $ git grep '"' pelican/*.py | wc -l 181 [1]: http://docs.python.org/3/library/os.html#os.sep
This commit is contained in:
parent
4e5454912f
commit
e5e455e0e5
3 changed files with 26 additions and 22 deletions
|
|
@ -13,9 +13,9 @@ from pelican.settings import read_settings
|
|||
from pelican.tests.support import LoggedTestCase
|
||||
|
||||
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
SAMPLES_PATH = os.path.abspath(os.sep.join((CURRENT_DIR, "..", "..",
|
||||
"samples")))
|
||||
OUTPUT_PATH = os.path.abspath(os.sep.join((CURRENT_DIR, "output")))
|
||||
SAMPLES_PATH = os.path.abspath(os.path.join(
|
||||
CURRENT_DIR, '..', '..', 'samples'))
|
||||
OUTPUT_PATH = os.path.abspath(os.path.join(CURRENT_DIR, 'output'))
|
||||
|
||||
INPUT_PATH = os.path.join(SAMPLES_PATH, "content")
|
||||
SAMPLE_CONFIG = os.path.join(SAMPLES_PATH, "pelican.conf.py")
|
||||
|
|
@ -23,11 +23,11 @@ SAMPLE_CONFIG = os.path.join(SAMPLES_PATH, "pelican.conf.py")
|
|||
|
||||
def recursiveDiff(dcmp):
|
||||
diff = {
|
||||
'diff_files': [os.sep.join((dcmp.right, f))
|
||||
'diff_files': [os.path.join(dcmp.right, f)
|
||||
for f in dcmp.diff_files],
|
||||
'left_only': [os.sep.join((dcmp.right, f))
|
||||
'left_only': [os.path.join(dcmp.right, f)
|
||||
for f in dcmp.left_only],
|
||||
'right_only': [os.sep.join((dcmp.right, f))
|
||||
'right_only': [os.path.join(dcmp.right, f)
|
||||
for f in dcmp.right_only],
|
||||
}
|
||||
for sub_dcmp in dcmp.subdirs.values():
|
||||
|
|
@ -74,7 +74,7 @@ class TestPelican(LoggedTestCase):
|
|||
})
|
||||
pelican = Pelican(settings=settings)
|
||||
pelican.run()
|
||||
dcmp = dircmp(self.temp_path, os.sep.join((OUTPUT_PATH, "basic")))
|
||||
dcmp = dircmp(self.temp_path, os.path.join(OUTPUT_PATH, 'basic'))
|
||||
self.assertFilesEqual(recursiveDiff(dcmp))
|
||||
self.assertLogCountEqual(
|
||||
count=10,
|
||||
|
|
@ -90,5 +90,5 @@ class TestPelican(LoggedTestCase):
|
|||
})
|
||||
pelican = Pelican(settings=settings)
|
||||
pelican.run()
|
||||
dcmp = dircmp(self.temp_path, os.sep.join((OUTPUT_PATH, "custom")))
|
||||
dcmp = dircmp(self.temp_path, os.path.join(OUTPUT_PATH, 'custom'))
|
||||
self.assertFilesEqual(recursiveDiff(dcmp))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue