3 Commits
v7 ... v9

Author SHA1 Message Date
df223bd19e La fonction d'aide renvoie le texte à afficher au lieu de l'afficher directement
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2021-01-26 17:45:44 +01:00
7c2d082cf4 On lint le fichier de tests également
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2021-01-26 17:39:54 +01:00
1ba9934438 Pytest est requis
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2021-01-26 17:08:30 +01:00
3 changed files with 15 additions and 12 deletions

View File

@ -8,7 +8,7 @@ flake8:
image: python:3-alpine
before_script:
- pip install flake8 --no-cache-dir
script: flake8 main.py
script: flake8 main.py main_test.py
allow_failure: true
@ -17,11 +17,13 @@ pylint:
image: python:3-alpine
before_script:
- pip install pylint --no-cache-dir
script: pylint main.py
script: pylint main.py main_test.py
allow_failure: true
test:
stage: test
image: python:3-alpine
script: pytest --show-locals .
before_script:
- pip install pytest --no-cache-dir
script: pytest --showlocals .

17
main.py
View File

@ -28,6 +28,9 @@ def main():
def commande(name: str, *args):
"""
Exécute la commande `name` avec les arguments donnés.
"""
return globals()[name](*args)
@ -35,13 +38,13 @@ def aide():
"""
Affiche l'aide
"""
print("aide\t\tAffiche l'aide")
print("seminaire\tLance le séminaire")
print("blague\t\tRaconte une blague")
print("calcul\t\tVérifie une opération arithmétique. "
"Par exemple, check(1, 2, 3, '+') renvoie True")
print("tri\t\tTrie une liste d'entiers.")
print("stop\t\tQuitte le programme")
return "aide\t\tAffiche l'aide\n" \
"seminaire\tLance le séminaire\n" \
"blague\t\tRaconte une blague\n" \
"calcul\t\tVérifie une opération arithmétique. " \
"Par exemple, check(1, 2, 3, '+') renvoie True\n" \
"tri\t\tTrie une liste d'entiers.\n" \
"stop\t\tQuitte le programme"
def seminaire():

View File

@ -4,8 +4,6 @@
Exécution des tests du script.
"""
import unittest
import main