mirror of
https://github.com/LazoCoder/Pokemon-Terminal
synced 2024-11-23 20:33:08 +00:00
Make main() a separate function so we can test it
This will enable us to use [pytest](https://docs.pytest.org) to do end-to-end tests like: https://github.com/LazoCoder/Pokemon-Terminal/pull/60/files#diff-1532f81ff7af5d26a72ae57cdbeabb53R19
This commit is contained in:
parent
16c49a97c1
commit
9c5b040571
1 changed files with 6 additions and 2 deletions
8
main.py
8
main.py
|
@ -2,7 +2,6 @@
|
|||
|
||||
# The main module that brings everything together.
|
||||
|
||||
from sys import argv
|
||||
from database import Database
|
||||
import random
|
||||
import scripter
|
||||
|
@ -265,7 +264,7 @@ def single_argument_handler(arg):
|
|||
change_terminal_background(db, arg)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
def main(argv):
|
||||
# Entrance to the program.
|
||||
if len(argv) == 1:
|
||||
print('No command line arguments specified.'
|
||||
|
@ -278,3 +277,8 @@ if __name__ == "__main__":
|
|||
else:
|
||||
print('Invalid number of arguments.'
|
||||
'\nType "help" to see all the commands.')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Entrance to the program.
|
||||
main(sys.argv)
|
||||
|
|
Loading…
Reference in a new issue