Skip to content

Commit

Permalink
Merge branch 'master' into stable/0.7.x
Browse files Browse the repository at this point in the history
  • Loading branch information
hodgestar committed Jun 15, 2024
2 parents 0dad9ea + af13855 commit 9019d11
Show file tree
Hide file tree
Showing 24 changed files with 95 additions and 60 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, "3.10", "3.11", pypy2, pypy3]
python-version: [3.6, 3.7, 3.8, 3.9, "3.10", "3.11", "3.12", "3.13.0-beta.2", pypy2, pypy3]

steps:
- uses: actions/checkout@v2
Expand All @@ -16,6 +16,10 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install setuptools
run: |
pip install setuptools
- name: Run test suite
run: |
python setup.py test
11 changes: 10 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Version 0.7.9
https://github.com/edgewall/genshi/releases/tag/0.7.9
(Jun 16 2024, from branches/stable/0.7.x)

* Add Python 3.12 to CI matrix and fix Python 3.12 support. (#77 by Simon Cross)
* Add Python 3.13 beta to CI. (#81 by Simon Cross)
* Add badges to the README. (#82 by Simon Cross)


Version 0.7.8
https://github.com/edgewall/genshi/releases/tag/0.7.8
(Jun 24 2024, from branches/stable/0.7.x)
(Jun 14 2024, from branches/stable/0.7.x)

* Do not merge sub directives if they have not been changed.
(#53 by Cédric Krier)
Expand Down
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
About Genshi
============

<!-- badges-start -->

[![ReadTheDocs badge](https://readthedocs.org/projects/genshi/badge/?version=latest&style=for-the-badge)](https://genshi.readthedocs.org/)
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/edgewall/genshi/tests.yml?branch=master&style=for-the-badge)](https://github.com/edgewall/genshi/actions/workflows/tests.yml)
[![PyPI - Version](https://img.shields.io/pypi/v/genshi?style=for-the-badge)](https://pypi.org/project/genshi/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/genshi?style=for-the-badge)](https://pypi.org/project/genshi/)
[![PyPI - Implementation](https://img.shields.io/pypi/implementation/genshi?style=for-the-badge)](https://pypi.org/project/genshi/)

<!-- badges-end -->

Genshi is a Python library that provides an integrated set of
components for parsing, generating, and processing HTML, XML or other
textual content for output generation on the web. The major feature is
a template language, which is heavily inspired by Kid.

For more information please see:

- [ReadTheDocs](https://genshi.readthedocs.org/)
- [https://genshi.edgewall.org/](https://genshi.edgewall.org/)
- the documentation in the `doc` directory.

12 changes: 0 additions & 12 deletions README.txt

This file was deleted.

5 changes: 4 additions & 1 deletion genshi/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,13 @@ def build_code_chunk(code, filename, name, lineno):
warnings.filterwarnings('error', category=DeprecationWarning)
try:
_ast_Ellipsis = ast.Ellipsis
_ast_Ellipsis_value = lambda obj: Ellipsis
_ast_Str = ast.Str
_ast_Str_value = lambda obj: obj.s
except (AttributeError, DeprecationWarning):
_ast_Ellipsis = _ast_Str = ast.Constant
_ast_Ellipsis = ast.Constant
_ast_Ellipsis_value = lambda obj: obj.value
_ast_Str = ast.Constant
_ast_Str_value = lambda obj: obj.value

class _DummyASTItem(object):
Expand Down
12 changes: 6 additions & 6 deletions genshi/filters/tests/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -2203,12 +2203,12 @@ def test_translate_context_with_msg(self):
def suite():
suite = unittest.TestSuite()
suite.addTest(doctest_suite(Translator.__module__))
suite.addTest(unittest.makeSuite(TranslatorTestCase, 'test'))
suite.addTest(unittest.makeSuite(MsgDirectiveTestCase, 'test'))
suite.addTest(unittest.makeSuite(ChooseDirectiveTestCase, 'test'))
suite.addTest(unittest.makeSuite(DomainDirectiveTestCase, 'test'))
suite.addTest(unittest.makeSuite(ExtractTestCase, 'test'))
suite.addTest(unittest.makeSuite(ContextDirectiveTestCase, 'test'))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(TranslatorTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(MsgDirectiveTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(ChooseDirectiveTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(DomainDirectiveTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(ExtractTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(ContextDirectiveTestCase))
return suite

if __name__ == '__main__':
Expand Down
4 changes: 2 additions & 2 deletions genshi/filters/tests/test_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,8 @@ def test_sanitize_unicode_url(self):
def suite():
suite = unittest.TestSuite()
suite.addTest(doctest_suite(HTMLFormFiller.__module__))
suite.addTest(unittest.makeSuite(HTMLFormFillerTestCase, 'test'))
suite.addTest(unittest.makeSuite(HTMLSanitizerTestCase, 'test'))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(HTMLFormFillerTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(HTMLSanitizerTestCase))
return suite


Expand Down
2 changes: 1 addition & 1 deletion genshi/filters/tests/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,7 @@ def suite():
EmptyTest, RemoveTest, UnwrapText, WrapTest, FilterTest,
MapTest, SubstituteTest, RenameTest, ReplaceTest, BeforeTest,
AfterTest, PrependTest, AppendTest, AttrTest, CopyTest, CutTest):
suite.addTest(unittest.makeSuite(test, 'test'))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(test))
suite.addTest(doctest_suite(
genshi.filters.transform, optionflags=doctest.NORMALIZE_WHITESPACE,
extraglobs={'HTML': HTML, 'tag': tag, 'Markup': Markup}))
Expand Down
7 changes: 5 additions & 2 deletions genshi/template/astutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"""Support classes for generating code from abstract syntax trees."""

from genshi.compat import ast as _ast, _ast_Constant, IS_PYTHON2, isstring, \
_ast_Ellipsis
_ast_Ellipsis, _ast_Ellipsis_value

__docformat__ = 'restructuredtext en'

Expand Down Expand Up @@ -721,7 +721,10 @@ def visit_Subscript(self, node):
self.visit(node.value)
self._write('[')
def _process_slice(node):
if isinstance(node, _ast_Ellipsis):
if (
isinstance(node, _ast_Ellipsis)
and _ast_Ellipsis_value(node) == Ellipsis
):
self._write('...')
elif isinstance(node, _ast.Slice):
if getattr(node, 'lower', 'None'):
Expand Down
2 changes: 1 addition & 1 deletion genshi/template/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_copy(self):
def suite():
suite = unittest.TestSuite()
suite.addTest(doctest.DocTestSuite(Template.__module__))
suite.addTest(unittest.makeSuite(ContextTestCase, 'test'))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(ContextTestCase))
return suite

if __name__ == '__main__':
Expand Down
20 changes: 10 additions & 10 deletions genshi/template/tests/directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -1217,16 +1217,16 @@ def test_with_empty_value(self):
def suite():
suite = unittest.TestSuite()
suite.addTest(doctest.DocTestSuite(directives))
suite.addTest(unittest.makeSuite(AttrsDirectiveTestCase, 'test'))
suite.addTest(unittest.makeSuite(ChooseDirectiveTestCase, 'test'))
suite.addTest(unittest.makeSuite(DefDirectiveTestCase, 'test'))
suite.addTest(unittest.makeSuite(ForDirectiveTestCase, 'test'))
suite.addTest(unittest.makeSuite(IfDirectiveTestCase, 'test'))
suite.addTest(unittest.makeSuite(MatchDirectiveTestCase, 'test'))
suite.addTest(unittest.makeSuite(ContentDirectiveTestCase, 'test'))
suite.addTest(unittest.makeSuite(ReplaceDirectiveTestCase, 'test'))
suite.addTest(unittest.makeSuite(StripDirectiveTestCase, 'test'))
suite.addTest(unittest.makeSuite(WithDirectiveTestCase, 'test'))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(AttrsDirectiveTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(ChooseDirectiveTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(DefDirectiveTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(ForDirectiveTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(IfDirectiveTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(MatchDirectiveTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(ContentDirectiveTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(ReplaceDirectiveTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(StripDirectiveTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(WithDirectiveTestCase))
return suite

if __name__ == '__main__':
Expand Down
4 changes: 2 additions & 2 deletions genshi/template/tests/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -1037,8 +1037,8 @@ def __init__(self):
def suite():
suite = unittest.TestSuite()
suite.addTest(doctest.DocTestSuite(Expression.__module__))
suite.addTest(unittest.makeSuite(ExpressionTestCase, 'test'))
suite.addTest(unittest.makeSuite(SuiteTestCase, 'test'))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(ExpressionTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(SuiteTestCase))
return suite

if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion genshi/template/tests/interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def test_interpolate_triplequoted(self):
def suite():
suite = unittest.TestSuite()
suite.addTest(doctest.DocTestSuite(interpolate.__module__))
suite.addTest(unittest.makeSuite(InterpolateTestCase, 'test'))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(InterpolateTestCase))
return suite

if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion genshi/template/tests/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ def test_prefix_delegation_to_directories_with_subdirs(self):
def suite():
suite = unittest.TestSuite()
suite.addTest(doctest.DocTestSuite(TemplateLoader.__module__))
suite.addTest(unittest.makeSuite(TemplateLoaderTestCase, 'test'))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(TemplateLoaderTestCase))
return suite

if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion genshi/template/tests/markup.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ def test_directive_single_line_with_translator(self):
def suite():
suite = unittest.TestSuite()
suite.addTest(doctest.DocTestSuite(MarkupTemplate.__module__))
suite.addTest(unittest.makeSuite(MarkupTemplateTestCase, 'test'))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(MarkupTemplateTestCase))
return suite

if __name__ == '__main__':
Expand Down
4 changes: 2 additions & 2 deletions genshi/template/tests/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ def test_helper_functions(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(MarkupTemplateEnginePluginTestCase, 'test'))
suite.addTest(unittest.makeSuite(TextTemplateEnginePluginTestCase, 'test'))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(MarkupTemplateEnginePluginTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(TextTemplateEnginePluginTestCase))
return suite

if __name__ == '__main__':
Expand Down
4 changes: 2 additions & 2 deletions genshi/template/tests/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ def test_include_expr(self):
def suite():
suite = unittest.TestSuite()
suite.addTest(doctest.DocTestSuite(NewTextTemplate.__module__))
suite.addTest(unittest.makeSuite(OldTextTemplateTestCase, 'test'))
suite.addTest(unittest.makeSuite(NewTextTemplateTestCase, 'test'))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(OldTextTemplateTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(NewTextTemplateTestCase))
return suite

if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion genshi/tests/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_markup_escape(self):
def suite():
suite = unittest.TestSuite()
suite.addTest(doctest.DocTestSuite(Element.__module__))
suite.addTest(unittest.makeSuite(ElementFactoryTestCase, 'test'))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(ElementFactoryTestCase))
return suite


Expand Down
10 changes: 5 additions & 5 deletions genshi/tests/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,11 @@ def test_curly_brace_equality(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(StreamTestCase, 'test'))
suite.addTest(unittest.makeSuite(MarkupTestCase, 'test'))
suite.addTest(unittest.makeSuite(NamespaceTestCase, 'test'))
suite.addTest(unittest.makeSuite(AttrsTestCase, 'test'))
suite.addTest(unittest.makeSuite(QNameTestCase, 'test'))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(StreamTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(MarkupTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(NamespaceTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(AttrsTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(QNameTestCase))
suite.addTest(doctest_suite(core))
return suite

Expand Down
4 changes: 2 additions & 2 deletions genshi/tests/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ def test_convert_ElementTree_to_markup_stream(self):
def suite():
suite = unittest.TestSuite()
suite.addTest(doctest_suite(XMLParser.__module__))
suite.addTest(unittest.makeSuite(XMLParserTestCase, 'test'))
suite.addTest(unittest.makeSuite(HTMLParserTestCase, 'test'))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(XMLParserTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(HTMLParserTestCase))
return suite

if __name__ == '__main__':
Expand Down
8 changes: 4 additions & 4 deletions genshi/tests/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,10 @@ def test_elem_content(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(XMLSerializerTestCase, 'test'))
suite.addTest(unittest.makeSuite(XHTMLSerializerTestCase, 'test'))
suite.addTest(unittest.makeSuite(HTMLSerializerTestCase, 'test'))
suite.addTest(unittest.makeSuite(EmptyTagFilterTestCase, 'test'))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(XMLSerializerTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(XHTMLSerializerTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(HTMLSerializerTestCase))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(EmptyTagFilterTestCase))
suite.addTest(doctest_suite(XMLSerializer.__module__))
return suite

Expand Down
2 changes: 1 addition & 1 deletion genshi/tests/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ def _test_eval(self, path, equiv=None, input=None, output='',
def suite():
suite = unittest.TestSuite()
suite.addTest(doctest_suite(Path.__module__))
suite.addTest(unittest.makeSuite(PathTestCase, 'test'))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(PathTestCase))
return suite


Expand Down
2 changes: 1 addition & 1 deletion genshi/tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_getitem(self):
def suite():
suite = unittest.TestSuite()
suite.addTest(doctest_suite(util))
suite.addTest(unittest.makeSuite(LRUCacheTestCase, 'test'))
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(LRUCacheTestCase))
return suite

if __name__ == '__main__':
Expand Down
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ classifiers =
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 3
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy
Topic :: Internet :: WWW/HTTP :: Dynamic Content
Topic :: Software Development :: Libraries :: Python Modules
Topic :: Text Processing :: Markup :: HTML
Expand All @@ -41,6 +43,8 @@ packages =
genshi.template.tests.templates
install_requires =
six
setup_requires =
setuptools

[options.entry_points]
babel.extractors =
Expand Down

0 comments on commit 9019d11

Please sign in to comment.