-
Notifications
You must be signed in to change notification settings - Fork 0
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
b96e435
commit f86ad59
Showing
3 changed files
with
47 additions
and
9 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
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,35 @@ | ||
import subprocess | ||
import glob | ||
|
||
def run_all_python_files(files): | ||
|
||
for file in files: | ||
print("Running", file) | ||
exit_code = run_python_script(file) | ||
if exit_code != 0: | ||
print(f"Error in {file}. Exiting with status code {exit_code}.") | ||
return exit_code | ||
return 0 | ||
|
||
|
||
def run_python_script(file_path): | ||
try: | ||
subprocess.check_output(["python3", file_path], stderr=subprocess.STDOUT, universal_newlines=True) | ||
return 0 | ||
except subprocess.CalledProcessError as e: | ||
print(f"Exception in {file_path}: {e.output}") | ||
return e.returncode | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
# Utilisez le motif '*.py' pour rechercher tous les fichiers se terminant par '.py' | ||
python_files = glob.glob('day_*/*.py') | ||
|
||
# Affichez la liste des fichiers trouvés | ||
print("Fichiers Python trouvés :") | ||
for file in python_files: | ||
print(file) | ||
exit_code = run_all_python_files(python_files) | ||
print(f"Exiting with status code {exit_code}.") | ||
exit(exit_code) |
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