Merge pull request #5876 from tk0miya/remove_magic_comments

Remove coding magic comments from tests
This commit is contained in:
Takeshi KOMIYA 2019-01-03 10:39:28 +09:00 committed by GitHub
commit 657fa843c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
93 changed files with 22 additions and 203 deletions

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
import os
import sys

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from docutils import nodes
from docutils.parsers.rst import Directive

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
import os
import sys

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from docutils.parsers import Parser

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
import os
import sys

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from docutils.parsers import Parser

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# set this by test
# import os
# import sys

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
import os
import sys

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from sphinx.writers.html import HTMLTranslator

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
latex_documents = [

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from sphinx.writers.html import HTMLTranslator
project = 'test'

View File

@ -1,4 +1,2 @@
# -*- coding: utf-8 -*-
project = 'test'
master_doc = 'index'

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
latex_documents = [

View File

@ -1,3 +1 @@
# -*- coding: utf-8 -*-
master_doc = 'index'

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
exclude_patterns = ['_build']
numfig = True

View File

@ -1,5 +1,4 @@
# Literally included file using Python highlighting
# -*- coding: utf-8 -*-
foo = "Including Unicode characters: üöä"

View File

@ -1,5 +1,4 @@
# Literally included file using Python highlighting
# -*- coding: utf-8 -*-
foo = "Including Unicode characters: üöä"

View File

@ -1,5 +1,4 @@
# Literally included file using Python highlighting
# -*- coding: utf-8 -*-
@class_decorator
@other_decorator()

View File

@ -1,5 +1,4 @@
# Literally included file using Python highlighting
# -*- coding: utf-8 -*-
foo = "Including Unicode characters: üöä"

View File

@ -1,3 +1 @@
# -*- coding: utf-8 -*-
master_doc = 'index'

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
project = 'Sphinx docutils conf <Tests>'
source_suffix = '.txt'
keep_warnings = True

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
html_theme = 'classic'
exclude_patterns = ['_build']

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
html_theme = 'classic'
exclude_patterns = ['_build']

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
html_theme = 'classic'
exclude_patterns = ['_build']

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
templates_path = ['_templates']
master_doc = 'index'
html_theme = 'base_theme2'

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
latex_documents = [

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
import enum
from io import StringIO

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
extensions = ['sphinx.ext.autosectionlabel']
master_doc = 'index'
autosectionlabel_prefix_document = True

View File

@ -1,4 +1,2 @@
# -*- coding: utf-8 -*-
extensions = ['sphinx.ext.autosectionlabel']
master_doc = 'index'

View File

@ -1,4 +1,2 @@
# -*- coding: utf-8 -*-
extensions = ['sphinx.ext.githubpages']
master_doc = 'index'

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
extensions = ['sphinx.ext.graphviz']
master_doc = 'index'
exclude_patterns = ['_build']

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
extensions = ['sphinx.ext.ifconfig']
master_doc = 'index'
exclude_patterns = ['_build']

View File

@ -1,4 +1,2 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
extensions = ['sphinx.ext.imgconverter']

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
import os
import sys

View File

@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
class Foo(object):
pass

View File

@ -1,4 +1,2 @@
# -*- coding: utf-8 -*-
extensions = ['sphinx.ext.intersphinx']
master_doc = 'index'

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from docutils.parsers.rst import Directive
from sphinx.ext.mathbase import math, displaymath

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
latex_documents = [

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
latex_documents = [

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
extensions = ['sphinx.ext.todo']
master_doc = 'index'

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
extensions = ['sphinx.ext.viewcode']
master_doc = 'index'
exclude_patterns = ['_build']

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
import os
import sys

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
html_theme = 'classic'
exclude_patterns = ['_build']

View File

@ -1,3 +1 @@
# -*- coding: utf-8 -*-
templates_path = ['_templates']

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
latex_documents = [

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
project = 'Sphinx'
version = '1.4.4'

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
html_theme = 'classic'
exclude_patterns = ['_build']

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
exclude_patterns = ['_build']

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
exclude_patterns = ['_build']

View File

@ -1,3 +1 @@
# -*- coding: utf-8 -*-
master_doc = 'index'

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
project = 'Sphinx intl <Tests>'
source_suffix = '.txt'
keep_warnings = True

View File

@ -1,4 +1,2 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
keep_warnings = True

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
numfig_format = {
'figure': 'Fig. %s',

View File

@ -1,4 +1,2 @@
# -*- coding: utf-8 -*-
master_doc = 'equations'
extensions = ['sphinx.ext.imgmath']

View File

@ -1,3 +1 @@
# -*- coding: utf-8 -*-
master_doc = 'index'

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
latex_documents = [

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
extensions = ['sphinx.ext.imgmath'] # for math_numfig

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
latex_documents = [

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
# set empty string to the third column to use the first section title to document title

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
html_theme = 'classic'
exclude_patterns = ['_build']

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
latex_documents = [

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
latex_documents = [

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
html_theme = 'classic'
exclude_patterns = ['_build']

View File

@ -1,3 +1 @@
# -*- coding: utf-8 -*-
master_doc = 'index'

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
project = 'need <b>"escaped"</b> project'
smartquotes = False

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
latex_documents = [

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
html_theme = 'classic'
exclude_patterns = ['_build']

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
import os
import sys
sys.path.insert(0, os.path.abspath('.'))

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from docutils.parsers import Parser

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
import os
import sys

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
#: constant on sample.py
CONSTANT = 1

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from setuptools import setup

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
html_compact_lists = False

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
latex_documents = [

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
import enum
from io import StringIO

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
import os
import sys

View File

@ -1,5 +1,4 @@
# Literally included file using Python highlighting
# -*- coding: utf-8 -*-
foo = "Including Unicode characters: üöä" # This will be changed

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
project = 'Sphinx smallest project'
source_suffix = '.txt'
keep_warnings = True

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
latex_documents = [

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
html_theme = 'classic'
templates_path = ['_templates']

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
project = 'Sphinx templating <Tests>'
source_suffix = '.txt'
keep_warnings = True

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
html_theme = 'test-theme'
html_theme_path = ['.', 'test_theme']
master_doc = 'index'

View File

@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
import os

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
html_theme = 'classic'
exclude_patterns = ['_build']

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
html_theme = 'classic'
exclude_patterns = ['_build']

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
html_theme = 'classic'
exclude_patterns = ['_build']

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
html_theme = 'classic'
exclude_patterns = ['_build']

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
latex_documents = [

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
extensions = ['sphinx.ext.doctest']

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
import os
import sys
sys.path.append(os.path.abspath('.'))

View File

@ -126,9 +126,7 @@ def test_errors_warnings(logger, tempdir):
assert 'conf.py' in str(excinfo.value)
# test the automatic conversion of 2.x only code in configs
(tempdir / 'conf.py').write_text(
'# -*- coding: utf-8\n\nproject = u"Jägermeister"\n',
encoding='utf-8')
(tempdir / 'conf.py').write_text('project = u"Jägermeister"\n', encoding='utf-8')
cfg = Config.read(tempdir, {}, None)
cfg.init_values()
assert cfg.project == 'Jägermeister'

View File

@ -36,18 +36,18 @@ def test_LiteralIncludeReader(literal_inc_path):
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
content, lines = reader.read()
assert content == literal_inc_path.text()
assert lines == 14
assert lines == 13
assert reader.lineno_start == 1
@pytest.mark.xfail(os.name != 'posix', reason="Not working on windows")
def test_LiteralIncludeReader_lineno_start(literal_inc_path):
options = {'lineno-start': 5}
options = {'lineno-start': 4}
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
content, lines = reader.read()
assert content == literal_inc_path.text()
assert lines == 14
assert reader.lineno_start == 5
assert lines == 13
assert reader.lineno_start == 4
@pytest.mark.xfail(os.name != 'posix', reason="Not working on windows")
@ -57,7 +57,7 @@ def test_LiteralIncludeReader_pyobject1(literal_inc_path):
content, lines = reader.read()
assert content == ("class Foo:\n"
" pass\n")
assert reader.lineno_start == 6
assert reader.lineno_start == 5
@pytest.mark.xfail(os.name != 'posix', reason="Not working on windows")
@ -91,18 +91,17 @@ def test_LiteralIncludeReader_pyobject_and_lines(literal_inc_path):
@pytest.mark.xfail(os.name != 'posix', reason="Not working on windows")
def test_LiteralIncludeReader_lines1(literal_inc_path):
options = {'lines': '1-4'}
options = {'lines': '1-3'}
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
content, lines = reader.read()
assert content == ("# Literally included file using Python highlighting\n"
"# -*- coding: utf-8 -*-\n"
"\n"
"foo = \"Including Unicode characters: üöä\"\n")
@pytest.mark.xfail(os.name != 'posix', reason="Not working on windows")
def test_LiteralIncludeReader_lines2(literal_inc_path):
options = {'lines': '1,4,6'}
options = {'lines': '1,3,5'}
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
content, lines = reader.read()
assert content == ("# Literally included file using Python highlighting\n"
@ -112,18 +111,18 @@ def test_LiteralIncludeReader_lines2(literal_inc_path):
@pytest.mark.xfail(os.name != 'posix', reason="Not working on windows")
def test_LiteralIncludeReader_lines_and_lineno_match1(literal_inc_path):
options = {'lines': '4-6', 'lineno-match': True}
options = {'lines': '3-5', 'lineno-match': True}
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
content, lines = reader.read()
assert content == ("foo = \"Including Unicode characters: üöä\"\n"
"\n"
"class Foo:\n")
assert reader.lineno_start == 4
assert reader.lineno_start == 3
@pytest.mark.sphinx() # init locale for errors
def test_LiteralIncludeReader_lines_and_lineno_match2(literal_inc_path, app, status, warning):
options = {'lines': '1,4,6', 'lineno-match': True}
options = {'lines': '0,3,5', 'lineno-match': True}
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
with pytest.raises(ValueError):
content, lines = reader.read()
@ -146,7 +145,7 @@ def test_LiteralIncludeReader_start_at(literal_inc_path):
" pass\n"
"\n"
"class Bar:\n")
assert reader.lineno_start == 6
assert reader.lineno_start == 5
@pytest.mark.xfail(os.name != 'posix', reason="Not working on windows")
@ -156,13 +155,13 @@ def test_LiteralIncludeReader_start_after(literal_inc_path):
content, lines = reader.read()
assert content == (" pass\n"
"\n")
assert reader.lineno_start == 7
assert reader.lineno_start == 6
@pytest.mark.xfail(os.name != 'posix', reason="Not working on windows")
def test_LiteralIncludeReader_start_after_and_lines(literal_inc_path):
options = {'lineno-match': True, 'lines': '6-',
'start-after': 'coding', 'end-before': 'comment'}
'start-after': 'Literally', 'end-before': 'comment'}
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
content, lines = reader.read()
assert content == ("\n"
@ -170,7 +169,7 @@ def test_LiteralIncludeReader_start_after_and_lines(literal_inc_path):
" def baz():\n"
" pass\n"
"\n")
assert reader.lineno_start == 8
assert reader.lineno_start == 7
@pytest.mark.xfail(os.name != 'posix', reason="Not working on windows")
@ -219,7 +218,7 @@ def test_LiteralIncludeReader_prepend(literal_inc_path):
@pytest.mark.xfail(os.name != 'posix', reason="Not working on windows")
def test_LiteralIncludeReader_dedent(literal_inc_path):
# dedent: 2
options = {'lines': '10-12', 'dedent': 2}
options = {'lines': '9-11', 'dedent': 2}
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
content, lines = reader.read()
assert content == (" def baz():\n"
@ -227,7 +226,7 @@ def test_LiteralIncludeReader_dedent(literal_inc_path):
"\n")
# dedent: 4
options = {'lines': '10-12', 'dedent': 4}
options = {'lines': '9-11', 'dedent': 4}
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
content, lines = reader.read()
assert content == ("def baz():\n"
@ -235,7 +234,7 @@ def test_LiteralIncludeReader_dedent(literal_inc_path):
"\n")
# dedent: 6
options = {'lines': '10-12', 'dedent': 6}
options = {'lines': '9-11', 'dedent': 6}
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
content, lines = reader.read()
assert content == ("f baz():\n"
@ -278,7 +277,7 @@ def test_LiteralIncludeReader_diff(testroot, literal_inc_path):
content, lines = reader.read()
assert content == ("--- " + testroot + "/literal-diff.inc\n"
"+++ " + testroot + "/literal.inc\n"
"@@ -7,8 +7,8 @@\n"
"@@ -6,8 +6,8 @@\n"
" pass\n"
" \n"
" class Bar:\n"
@ -353,7 +352,7 @@ def test_code_block_namedlink_latex(app, status, warning):
def test_code_block_emphasize_latex(app, status, warning):
app.builder.build(['emphasize'])
latex = (app.outdir / 'Python.tex').text(encoding='utf-8').replace('\r\n', '\n')
includes = '\\fvset{hllines={, 5, 6, 13, 14, 15, 24, 25, 26, 27,}}%\n'
includes = '\\fvset{hllines={, 5, 6, 13, 14, 15, 24, 25, 26,}}%\n'
assert includes in latex
includes = '\\end{sphinxVerbatim}\n\\sphinxresetverbatimhllines\n'
assert includes in latex
@ -414,8 +413,7 @@ def test_literal_include_linenos(app, status, warning):
'10\n'
'11\n'
'12\n'
'13\n'
'14</pre></div></td>' in html)
'13</pre></div></td>' in html)
# :lineno-start:
assert ('<td class="linenos"><div class="linenodiv"><pre>'
@ -431,8 +429,7 @@ def test_literal_include_linenos(app, status, warning):
'209\n'
'210\n'
'211\n'
'212\n'
'213</pre></div></td>' in html)
'212</pre></div></td>' in html)
# :lineno-match:
assert ('<td class="linenos"><div class="linenodiv"><pre>'