-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_all_examples.py
52 lines (40 loc) · 1.48 KB
/
run_all_examples.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python
# -*- coding: utf-8 -*-
## -- Script Meta Data --
## Author : jlerat
## Created : 2018-09-16 21:14:03.674849
## Comment : Run all example scripts
##
## ------------------------------
import sys, os, re
from pathlib import Path
import subprocess
from hydrodiy.io import csv, iutils
#----------------------------------------------------------------------
# Config
#----------------------------------------------------------------------
#----------------------------------------------------------------------
# Folders
#----------------------------------------------------------------------
source_file = Path(__file__).resolve()
froot = source_file.parent
#----------------------------------------------------------------------
# Logging
#----------------------------------------------------------------------
basename = re.sub("\\.py.*", "", source_file.stem)
LOGGER = iutils.get_logger(basename)
#----------------------------------------------------------------------
# Get data
#----------------------------------------------------------------------
lf = froot.glob("*.py")
#----------------------------------------------------------------------
# Process
#----------------------------------------------------------------------
for f in lf:
if re.search("run_all_examples", f.stem):
LOGGER.info("Skip "+ f.stem)
continue
LOGGER.info(f"Running {f.stem}")
cmd = f"python {f}"
subprocess.check_call(cmd, shell=True)
LOGGER.info("Process completed")