Skip to content

Conversation

@westurner
Copy link
Contributor

@westurner westurner commented Oct 1, 2020

This is necessary so that make doesn't fail to execute this task due to markdown-it returning True (1) instead of zero (0) for success:

header-footer-templates:	@#pip install markdown-it-py	markdown-it README.md.header.md > index.html.header.html	markdown-it README.md.footer.md > index.html.footer.html 
@westurner westurner force-pushed the BUG_fix_cli_returncode branch from 2578c9c to 386be1c Compare October 1, 2020 15:48
@codecov
Copy link

codecov bot commented Oct 1, 2020

Codecov Report

Merging #55 into master will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@ Coverage Diff @@ ## master #55 +/- ## ========================================== + Coverage 95.40% 95.43% +0.02%  ========================================== Files 75 73 -2 Lines 3745 3567 -178 ========================================== - Hits 3573 3404 -169  + Misses 172 163 -9 
Flag Coverage Δ
pytests 95.43% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
markdown_it/cli/parse.py 81.48% <100.00%> (+3.70%) ⬆️
markdown_it/rules_block/state_block.py 88.72% <0.00%> (-0.33%) ⬇️
markdown_it/rules_core/__init__.py 100.00% <0.00%> (ø)
markdown_it/extensions/anchors/index.py 100.00% <0.00%> (ø)
markdown_it/rules_core/replacements.py
markdown_it/rules_core/smartquotes.py

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 901c180...953f0f0. Read the comment docs.

@westurner westurner mentioned this pull request Oct 1, 2020
@westurner westurner force-pushed the BUG_fix_cli_returncode branch from 386be1c to 1a27821 Compare October 1, 2020 16:22
@westurner westurner changed the title BUG: cli.parse: return 0 for non-error #53 🐛 FIX: cli.parse: return 0 for non-error #53 Oct 1, 2020
@westurner westurner force-pushed the BUG_fix_cli_returncode branch from 1a27821 to 1d71c4c Compare October 1, 2020 17:55
def test_parse_fail():
with pytest.raises(SystemExit) as exc_info:
parse.main(["/tmp/nonexistant_path/for_cli_test.md"])
assert exc_info.value.code == 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One way to fix the test failure is:

Suggested change
assert exc_info.value.code == 1
assert isinstance(exc_info.value.code, str)

Another way, that I personally would prefer but don't know if @chrisjsewell would, is go to markdown_it.cli.parse.convert_file and replace

sys.exit('Cannot open file "{}".'.format(filename))

with

sys.stderr.write('Cannot open file "{}".\n'.format(filename)) sys.exit(1)
@chrisjsewell
Copy link
Member

Superseded by #124

@westurner
Copy link
Contributor Author

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants