mirror of
https://github.com/LazoCoder/Pokemon-Terminal
synced 2024-11-24 04:43:10 +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.
|
# The main module that brings everything together.
|
||||||
|
|
||||||
from sys import argv
|
|
||||||
from database import Database
|
from database import Database
|
||||||
import random
|
import random
|
||||||
import scripter
|
import scripter
|
||||||
|
@ -265,7 +264,7 @@ def single_argument_handler(arg):
|
||||||
change_terminal_background(db, arg)
|
change_terminal_background(db, arg)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
def main(argv):
|
||||||
# Entrance to the program.
|
# Entrance to the program.
|
||||||
if len(argv) == 1:
|
if len(argv) == 1:
|
||||||
print('No command line arguments specified.'
|
print('No command line arguments specified.'
|
||||||
|
@ -278,3 +277,8 @@ if __name__ == "__main__":
|
||||||
else:
|
else:
|
||||||
print('Invalid number of arguments.'
|
print('Invalid number of arguments.'
|
||||||
'\nType "help" to see all the commands.')
|
'\nType "help" to see all the commands.')
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
# Entrance to the program.
|
||||||
|
main(sys.argv)
|
||||||
|
|
Loading…
Reference in a new issue