Skip to content

Commit

Permalink
Remove a few remnants of the past
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Jul 31, 2018
1 parent f392984 commit 2a813b1
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 64 deletions.
2 changes: 1 addition & 1 deletion docs/manual.rst
Expand Up @@ -1586,7 +1586,7 @@ Fancy Dates
Nikola can use various styles for presenting dates.

DATE_FORMAT
The date format to use if there is no JS or fancy dates are off. Compatible with Python’s ``strftime()`` syntax.
The date format to use if there is no JS or fancy dates are off. `Compatible with CLDR syntax. <http://cldr.unicode.org/translation/date-time>`_

JS_DATE_FORMAT
The date format to use if fancy dates are on. Compatible with ``moment.js`` syntax.
Expand Down
35 changes: 0 additions & 35 deletions dodo.py
@@ -1,7 +1,6 @@

import os
import fnmatch
import locale
import subprocess

DOIT_CONFIG = {
Expand Down Expand Up @@ -33,50 +32,16 @@ def task_pydocstyle():
}


def task_locale():
"""set environ locale vars used in nikola tests"""
def set_nikola_test_locales():
try:
out = subprocess.check_output(['locale', '-a'])
out = out.decode('utf-8')
locales = []
languages = set()
for line in out.splitlines():
if (line.endswith('.utf8') or line.endswith('.UTF-8')) and '_' in line:
lang = line.split('_')[0]
if lang not in languages:
try:
locale.setlocale(locale.LC_ALL, str(line))
except Exception:
continue
languages.add(lang)
locales.append((lang, line))
if len(locales) == 2:
break
if len(locales) != 2:
return False # task failed
else:
os.environ['NIKOLA_LOCALE_DEFAULT'] = ','.join(locales[0])
os.environ['NIKOLA_LOCALE_OTHER'] = ','.join(locales[1])
finally:
# restore to default locale
locale.resetlocale()

return {'actions': [set_nikola_test_locales], 'verbosity': 2}


def task_test():
"""run unit-tests using py.test"""
return {
'task_dep': ['locale'],
'actions': ['py.test tests/'],
}


def task_coverage():
"""run unit-tests using py.test, with coverage reporting"""
return {
'task_dep': ['locale'],
'actions': ['py.test --cov nikola --cov-report term-missing tests/'],
'verbosity': 2,
}
Expand Down
28 changes: 0 additions & 28 deletions tests/base.py
Expand Up @@ -53,34 +53,6 @@ def initialize_localeborg():
nikola.utils.LocaleBorg.initialize({}, LOCALE_DEFAULT)


class LocaleSupportInTesting(object):
"""
Nikola needs two pairs of valid (language, locale_n) to test multilingual sites.
As languages of interest and installed OS support varies from host to host
we allow to specify two such pairs.
A valid pair complies
'languaje' one of the names of nikola translations ('en', 'es', ...)
'locale_n' is a string that python accepts to set a locale, like in
import locale
locale.setlocale(locale.LC_ALL, str(locale_n))
You specify the custom pairs to use with two environment variables
NIKOLA_LOCALE_DEFAULT (lang and locale to use as nikola's DEFAULT_LANG)
NIKOLA_LOCALE_OTHER
The value of the pair is lang (as in keys of Nikola's TRANSLATIONS), followed
by coma, followed by the locale.
"""

@classmethod
def initialize_locales_for_testing(cls, variant):
"""initializes nikola.utils.LocaleBorg"""
nikola.utils.LocaleBorg.reset()
nikola.utils.LocaleBorg.initialize({}, 'en')


class FakePost(object):

def __init__(self, title, slug):
Expand Down

0 comments on commit 2a813b1

Please sign in to comment.