Browse Source

allow pytest-cov to consider codes in Python pool.

v0.1
jajupmochi 5 years ago
parent
commit
02e7e134a1
4 changed files with 15 additions and 16 deletions
  1. +4
    -1
      .travis.yml
  2. +7
    -7
      gklearn/tests/requirements.txt
  3. +0
    -7
      gklearn/utils/ipython_log.py
  4. +4
    -1
      gklearn/utils/parallel.py

+ 4
- 1
.travis.yml View File

@@ -14,7 +14,10 @@ before_install:
- pip install pytest-cov

install:
- pip install -r requirements.txt
- if [ $TRAVIS_PYTHON_VERSION == 3.8 ];
then pip install -r gklearn/tests/requirements.txt;
else pip install -r requirements.txt;
fi
- pip install wheel

script:


+ 7
- 7
gklearn/tests/requirements.txt View File

@@ -1,7 +1,7 @@
numpy==1.15.2
scipy==1.1.0
matplotlib==3.0.0
networkx==2.2
scikit-learn==0.20.0
tabulate==0.8.2
tqdm==4.26.0
numpy
scipy
matplotlib
networkx
scikit-learn
tabulate
tqdm

+ 0
- 7
gklearn/utils/ipython_log.py View File

@@ -1,7 +0,0 @@
# IPython log file

runfile('/media/ljia/DATA/research-repo/codes/Linlin/py-graph/preimage/test_iam.py', wdir='/media/ljia/DATA/research-repo/codes/Linlin/py-graph/preimage')
runfile('/media/ljia/DATA/research-repo/codes/Linlin/py-graph/preimage/test_iam.py', wdir='/media/ljia/DATA/research-repo/codes/Linlin/py-graph/preimage')
runfile('/media/ljia/DATA/research-repo/codes/Linlin/py-graph/preimage/test_iam.py', wdir='/media/ljia/DATA/research-repo/codes/Linlin/py-graph/preimage')
runfile('/media/ljia/DATA/research-repo/codes/Linlin/py-graph/preimage/test_iam.py', wdir='/media/ljia/DATA/research-repo/codes/Linlin/py-graph/preimage')
runfile('/media/ljia/DATA/research-repo/codes/Linlin/py-graph/preimage/test_iam.py', wdir='/media/ljia/DATA/research-repo/codes/Linlin/py-graph/preimage')

+ 4
- 1
gklearn/utils/parallel.py View File

@@ -33,6 +33,8 @@ def parallel_me(func, func_assign, var_to_assign, itr, len_itr=None, init_worker
desc=itr_desc, file=sys.stdout) if verbose else
pool.imap_unordered(func, itr, chunksize)):
func_assign(result, var_to_assign)
pool.close()
pool.join()
else:
if n_jobs == None:
n_jobs = multiprocessing.cpu_count()
@@ -46,7 +48,8 @@ def parallel_me(func, func_assign, var_to_assign, itr, len_itr=None, init_worker
desc=itr_desc, file=sys.stdout) if verbose else
pool.imap_unordered(func, itr, chunksize)):
func_assign(result, var_to_assign)
pool.close()
pool.join()

def parallel_gm(func, Kmatrix, Gn, init_worker=None, glbv=None,


Loading…
Cancel
Save