1""" 2 test_ext_githubpages 3 ~~~~~~~~~~~~~~~~~~~~ 4 5 Test sphinx.ext.githubpages extension. 6 7 :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. 8 :license: BSD, see LICENSE for details. 9""" 10 11import pytest 12 13 14@pytest.mark.sphinx('html', testroot='ext-githubpages') 15def test_githubpages(app, status, warning): 16 app.builder.build_all() 17 assert (app.outdir / '.nojekyll').exists() 18 assert not (app.outdir / 'CNAME').exists() 19 20 21@pytest.mark.sphinx('html', testroot='ext-githubpages', 22 confoverrides={'html_baseurl': 'https://sphinx-doc.github.io'}) 23def test_no_cname_for_github_io_domain(app, status, warning): 24 app.builder.build_all() 25 assert (app.outdir / '.nojekyll').exists() 26 assert not (app.outdir / 'CNAME').exists() 27 28 29@pytest.mark.sphinx('html', testroot='ext-githubpages', 30 confoverrides={'html_baseurl': 'https://sphinx-doc.org'}) 31def test_cname_for_custom_domain(app, status, warning): 32 app.builder.build_all() 33 assert (app.outdir / '.nojekyll').exists() 34 assert (app.outdir / 'CNAME').read_text() == 'sphinx-doc.org' 35