Skip to content

Commit

Permalink
Assure ansi2html can be called as script or module
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Oct 14, 2020
1 parent 45c7747 commit 6181253
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ansi2html/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from ansi2html.converter import main

if __name__ == "__main__":
main()
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ setup_requires =
setuptools_scm >= 1.15.0
setuptools_scm_git_archive >= 1.0

[options.entry_points]
console_scripts =
ansi2html = ansi2html.__main__:main

[options.packages.find]
where = .

Expand Down
9 changes: 9 additions & 0 deletions tests/test_ansi2html.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import unittest
from io import StringIO
from os.path import abspath, dirname, join
from subprocess import run

from mock import patch

Expand Down Expand Up @@ -385,6 +386,14 @@ def test_latex_linkify(self):
latex = Ansi2HTMLConverter(latex=True, inline=True, linkify=True).convert(ansi)
assert target in latex

def test_command_script(self):
result = run(["ansi2html", "--version"], check=True)
assert result.returncode == 0

def test_command_module(self):
result = run(["python3", "-m", "ansi2html", "--version"], check=True)
assert result.returncode == 0


if __name__ == "__main__":
unittest.main()

0 comments on commit 6181253

Please sign in to comment.