-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e620943
commit c358fa1
Showing
6 changed files
with
42 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: pytest | ||
name: tox | ||
|
||
on: | ||
push: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from .shadowfinder import ShadowFinder | ||
from .cli import ShadowFinderCli | ||
|
||
__all__ = ["ShadowFinder"] | ||
__all__ = ["ShadowFinder", "ShadowFinderCli"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
from cli import ShadowFinderCli | ||
from . import ShadowFinderCli | ||
import fire | ||
|
||
|
||
def main_entrypoint(): | ||
def main(): | ||
fire.Fire(ShadowFinderCli) | ||
|
||
|
||
if __name__ == "__main__": | ||
main_entrypoint() | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
""" | ||
The tests in this file test that running shadowfinder as an executable behaves | ||
as expected. | ||
""" | ||
import subprocess | ||
|
||
|
||
def test_executable_without_args(): | ||
"""Tests that running shadowfinder without any arguments returns the CLI's help string and 0 exit code.""" | ||
# GIVEN | ||
expected = """ | ||
NAME | ||
shadowfinder | ||
SYNOPSIS | ||
shadowfinder COMMAND | ||
COMMANDS | ||
COMMAND is one of the following: | ||
find | ||
Find the shadow length of an object given its height and the date and time. | ||
find_sun | ||
Locate a shadow based on the solar altitude angle and the date and time. | ||
""" | ||
|
||
# WHEN | ||
result = subprocess.run(['shadowfinder'], capture_output=True, text=True) | ||
|
||
# THEN | ||
assert result.returncode == 0 | ||
assert result.stdout.strip() == expected.strip() |