Skip to content

Commit c2f9d8e

Browse files
committed
revert accidental commit
1 parent 731e0f8 commit c2f9d8e

File tree

6 files changed

+6
-47
lines changed

6 files changed

+6
-47
lines changed

snooty/main.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import watchdog.events
2626
import watchdog.observers
2727
from pathlib import Path, PurePath
28-
from typing import Any, Dict, List, Optional, Union, Sequence
28+
from typing import Any, Dict, List, Optional, Union
2929
from docopt import docopt
3030

3131
from . import language_server
@@ -39,7 +39,6 @@
3939
logger = logging.getLogger(__name__)
4040
SNOOTY_ENV = os.getenv("SNOOTY_ENV", "development")
4141
PACKAGE_ROOT = Path(sys.modules["snooty"].__file__).resolve().parent
42-
4342
if PACKAGE_ROOT.is_file():
4443
PACKAGE_ROOT = PACKAGE_ROOT.parent
4544

@@ -83,7 +82,6 @@ def dispatch(self, event: watchdog.events.FileSystemEvent) -> None:
8382

8483

8584
class Backend:
86-
8785
def __init__(self) -> None:
8886
self.total_errors = 0
8987

@@ -251,10 +249,9 @@ def _generate_build_identifiers(args: Dict[str, Optional[str]]) -> BuildIdentifi
251249
return identifiers
252250

253251

254-
def main(argv: Optional[Sequence[str]] = None) -> None:
252+
def main() -> None:
255253
# docopt will terminate here and display usage instructions if snooty is run improperly
256-
print(argv)
257-
args = docopt(__doc__, argv)
254+
args = docopt(__doc__)
258255

259256
logging.basicConfig(level=logging.INFO)
260257

@@ -266,7 +263,6 @@ def main(argv: Optional[Sequence[str]] = None) -> None:
266263
return
267264

268265
url = args["<mongodb-url>"]
269-
270266
connection = (
271267
None if not url else pymongo.MongoClient(url, password=getpass.getpass())
272268
)
@@ -292,11 +288,5 @@ def main(argv: Optional[Sequence[str]] = None) -> None:
292288
print("Closing connection...")
293289
connection.close()
294290

295-
if(project.config.fail_on_diagnostics):
296-
EXIT_STATUS_ERROR_DIAGNOSTICS = 1
297-
#print("TOTAL ERRORS: ", project.config.fail_on_diagnostics, "\n\n cheese")
298-
print(backend.total_errors)
299-
assert False
300-
301291
if args["build"] and backend.total_errors > 0:
302292
sys.exit(EXIT_STATUS_ERROR_DIAGNOSTICS)

snooty/test_main.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import os
22
import json
33
import builtins
4-
import subprocess
5-
from subprocess import run
6-
from pathlib import Path
74
from typing import Any, List
85
from .types import FileId
96
from .diagnostics import InvalidLiteralInclude, InvalidURL, UnknownSubstitution
@@ -75,8 +72,3 @@ def test_print(*values: Any, **kwargs: Any) -> None:
7572
}
7673
},
7774
]
78-
79-
def test_main():
80-
subprocess.call(["snooty", "build", "test_data/test_parser_failure"])
81-
#subprocess.call(["ls", "-l"])
82-
#main.main(["build", 'test_data'])

snooty/test_parser.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
def test_tabs() -> None:
2424
tabs_path = ROOT_PATH.joinpath(Path("test_tabs.rst"))
2525
project_config = ProjectConfig(ROOT_PATH, "")
26-
print(project_config)
27-
assert False
2826
parser = rstparser.Parser(project_config, JSONVisitor)
2927
page, diagnostics = parse_rst(parser, tabs_path, None)
3028
page.finish(diagnostics)
@@ -88,8 +86,6 @@ def test_tabs_invalid_yaml() -> None:
8886
def test_codeblock() -> None:
8987
tabs_path = ROOT_PATH.joinpath(Path("test.rst"))
9088
project_config = ProjectConfig(ROOT_PATH, "")
91-
print(project_config)
92-
assert False
9389
parser = rstparser.Parser(project_config, JSONVisitor)
9490

9591
# Test a simple code-block
@@ -170,9 +166,8 @@ def test_codeblock() -> None:
170166
def test_literalinclude() -> None:
171167
path = ROOT_PATH.joinpath(Path("test.rst"))
172168
project_config = ProjectConfig(ROOT_PATH, "", source="./")
173-
print(ProjectConfig.open(path))
174169
parser = rstparser.Parser(project_config, JSONVisitor)
175-
170+
176171
# Test a simple literally-included code block
177172
page, diagnostics = parse_rst(
178173
parser,
@@ -182,7 +177,6 @@ def test_literalinclude() -> None:
182177
""",
183178
)
184179
page.finish(diagnostics)
185-
print(parser.project_config.open(ROOT_PATH))
186180
assert diagnostics == []
187181
check_ast_testing_string(
188182
page.ast,
@@ -213,7 +207,6 @@ def test_literalinclude() -> None:
213207
""",
214208
)
215209
page.finish(diagnostics)
216-
print(parser.project_config)
217210
assert diagnostics == []
218211
check_ast_testing_string(
219212
page.ast,
@@ -326,7 +319,6 @@ def test_literalinclude() -> None:
326319
:end-before: end example 1
327320
""",
328321
)
329-
print(parser.project_config)
330322
page.finish(diagnostics)
331323
assert len(diagnostics) == 1
332324
assert isinstance(diagnostics[0], InvalidLiteralInclude)
@@ -339,7 +331,7 @@ def test_literalinclude() -> None:
339331
</directive>
340332
</root>""",
341333
)
342-
print(parser.project_config)
334+
343335
# Test poorly specified linenos: out-of-bounds (greater than file length)
344336
page, diagnostics = parse_rst(
345337
parser,
@@ -391,8 +383,7 @@ def test_literalinclude() -> None:
391383
page.finish(diagnostics)
392384
assert len(diagnostics) == 1
393385
assert isinstance(diagnostics[0], DocUtilsParseError)
394-
print(parser.project_config)
395-
assert False
386+
396387

397388
def test_include() -> None:
398389
path = ROOT_PATH.joinpath(Path("test.rst"))
@@ -608,7 +599,6 @@ def test_roles() -> None:
608599
</list>
609600
</root>""",
610601
)
611-
assert False
612602

613603

614604
def test_doc_role() -> None:

snooty/types.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@ def finish(
373373
class ProjectConfig:
374374
root: Path
375375
name: str
376-
fail_on_diagnostics: bool
377376
default_domain: Optional[str] = field(default=None)
378377
title: str = field(default="untitled")
379378
source: str = field(default="source")
@@ -402,7 +401,6 @@ def open(cls, root: Path) -> Tuple["ProjectConfig", List[Diagnostic]]:
402401
try:
403402
with path.joinpath("snooty.toml").open(encoding="utf-8") as f:
404403
data = toml.load(f)
405-
print(data)
406404
data["root"] = path
407405
result, parsed_diagnostics = check_type(
408406
ProjectConfig, data
@@ -411,7 +409,6 @@ def open(cls, root: Path) -> Tuple["ProjectConfig", List[Diagnostic]]:
411409
except FileNotFoundError:
412410
pass
413411
except LoadError as err:
414-
415412
diagnostics.append(UnmarshallingError(str(err), 0))
416413

417414
path = path.parent

test_data/test_parser_failure/snooty.toml

Lines changed: 0 additions & 7 deletions
This file was deleted.

test_data/test_parser_failure/test.rst

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)