2019-03-04 09:58:12 -06:00
|
|
|
"""Test the ChangesBuilder class."""
|
|
|
|
|
2024-11-22 15:54:26 -06:00
|
|
|
from __future__ import annotations
|
|
|
|
|
2019-03-04 09:58:12 -06:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.sphinx('changes', testroot='changes')
|
|
|
|
def test_build(app):
|
|
|
|
app.build()
|
|
|
|
|
|
|
|
# TODO: Use better checking of html content
|
2022-04-26 21:04:19 -05:00
|
|
|
htmltext = (app.outdir / 'changes.html').read_text(encoding='utf8')
|
2024-04-05 06:32:55 -05:00
|
|
|
assert 'Added in version 0.6: Some funny stuff.' in htmltext
|
2019-03-04 09:58:12 -06:00
|
|
|
assert 'Changed in version 0.6: Even more funny stuff.' in htmltext
|
|
|
|
assert 'Deprecated since version 0.6: Boring stuff.' in htmltext
|
|
|
|
|
|
|
|
path_html = (
|
|
|
|
'<b>Path</b>: <i>deprecated:</i> Deprecated since version 0.6:'
|
2024-08-11 08:58:56 -05:00
|
|
|
' So, that was a bad idea it turns out.'
|
|
|
|
)
|
2019-03-04 09:58:12 -06:00
|
|
|
assert path_html in htmltext
|
|
|
|
|
|
|
|
malloc_html = (
|
2020-03-12 10:59:30 -05:00
|
|
|
'<b>void *Test_Malloc(size_t n)</b>: <i>changed:</i> Changed in version 0.6:'
|
2024-08-11 08:58:56 -05:00
|
|
|
' Can now be replaced with a different allocator.</a>'
|
|
|
|
)
|
2019-03-04 09:58:12 -06:00
|
|
|
assert malloc_html in htmltext
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.sphinx(
|
2024-08-11 08:58:56 -05:00
|
|
|
'changes',
|
|
|
|
testroot='changes',
|
|
|
|
srcdir='changes-none',
|
|
|
|
confoverrides={'version': '0.7', 'release': '0.7b1'},
|
|
|
|
)
|
2024-07-23 09:35:55 -05:00
|
|
|
def test_no_changes(app):
|
2019-03-04 09:58:12 -06:00
|
|
|
app.build()
|
|
|
|
|
2024-07-23 09:35:55 -05:00
|
|
|
assert 'no changes in version 0.7.' in app.status.getvalue()
|
2019-03-04 09:58:12 -06:00
|
|
|
assert not (app.outdir / 'changes.html').exists()
|