summaryrefslogtreecommitdiff
path: root/tools/travis/script.sh
blob: bee0c2feca8faf8bb40f206bf695cadc8a90bac7 (plain)
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
#!/usr/bin/env bash

set -e

section "Script section"

export NX_SOURCE=$PWD
export NX_INSTALL=$(pip show networkx | grep Location | awk '{print $2"/networkx"}')

# nose 1.3.0 does not tell coverage to only cover the requested
# package (except during the report).  So to restrict coverage, we must
# inform coverage through the .coveragerc file.
cp .coveragerc $NX_INSTALL

# Move to new directory so that networkx is not imported from repository.
# Why? Because we want the tests to make sure that NetworkX was installed
# correctly. Example: setup.py might not have included some submodules.
# Testing from the git repository cannot catch a mistake like that.
#
# Export current directory for logs.
cd $NX_INSTALL
printenv PWD

# Run nosetests.
if [[ "${REPORT_COVERAGE}" == 1 ]]; then
  pytest --cov=networkx --pyargs networkx
  cp -a .coverage $NX_SOURCE
else
  pytest --pyargs networkx
fi

cd $NX_SOURCE

section_end "Script section"

set +e