Skip to content

Commit

Permalink
Merge pull request #161 from Autodesk/intro_experience
Browse files Browse the repository at this point in the history
Test coverage and bug fixes
  • Loading branch information
avirshup authored Jun 15, 2017
2 parents 424d061 + adb7f40 commit c64d3dc
Show file tree
Hide file tree
Showing 67 changed files with 2,298 additions and 22,815 deletions.
33 changes: 33 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[paths]
source =
moldesign
*/site-packages/moldesign
*/dist-packages/moldesign


[run]
source = moldesign
omit =
moldesign/_notebooks/*
moldesign/_tests/*
moldesign/_static_data/*
moldesign/_version.py
moldesign/external/*
moldesign/widgets.py
moldesign/interfaces/nbo_interface.py
moldesign/utils/_deadfunctions.py
moldesign/utils/docparsers/google.py

[report]
exclude_lines =
pragma: no cover
def __repr__
def __str__
def _repr_markdown_
raise AssertionError
raise NotImplementedError
if PY2
if future.utils.PY2
def show
def unshow

File renamed without changes.
21 changes: 11 additions & 10 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
# DEVELOPING MDT

### Setting up a dev environment
(WIP)
(still under construction)

### Install prerequisites (first time only)
To make these instructions reasonably cross-platform, we'll use pyenv as the python environment manager.
### Install prequisites (first time only)
You need to install docker, and an environment manager for Python 3 (Miniconda 3). Here's one way to do that:
1. Install docker: [link]
2. Install pyenv and pyenv-venv: [link]
3. Install miniconda2 by running: `pyenv install miniconda2-latest`
4. Switch to miniconda environment by running: `pyenv shell miniconda2-latest`
3. Install miniconda3 by running: `pyenv install miniconda3-latest`
4. Switch to miniconda environment by running: `pyenv shell miniconda3-latest`

### Set up your environment (first time only)
1. Change directory to the base of the `molecular-design-toolkit` repository
1. Get MDT: `git clone http://github.com/Autodesk/molecular-design-toolkit`
1. `cd molecular-design-toolkit`
1. Create conda environment (optional but recommended) by running: [command to create conda env]
2. Activate the environment: `pyenv shell [environment name???]`
1. Install dev dependencies: `pip install -r requirements.txt DockerMakefiles/requirements.txt moldesign/_tests/requirements.txt`
2. Activate the environment: `pyenv activate [environment name???]`
1. Install dev dependencies: `pip install -r requirements.txt DockerMakefiles/requirements.txt deployment/requirements.txt`
2. Set up for local dev mode (this tells MDT to use your local docker containers):
```bash
mkdir ~/.moldesign
echo "devmode: true" > ~/.moldesign/moldesign.yml
```
8. Link your installation within your environment
8. Install MDT in "development mode":
```
pip install -e molecular-design-toolkit
```

### To activate environment (in any new shell)
1. Run `pyenv shell [environment name???]`
1. Run `pyenv activate [environment name???]`

### To rebuild docker images (first time and after changes that affect dockerized code)
5. Build development versions of all docker images:
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ include CONTRIBUTING.md
include DEVELOPMENT.md
include NOTICES
include moldesign/HISTORY.rst
include .coveragerc
recursive-include moldesign/_static_data *.*
recursive-include moldesign/_notebooks *.*
global-exclude *.py[cod] __pycache__ *~ *.bak
8 changes: 4 additions & 4 deletions codeship-services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test_moldesign_minimal:
context: ./deployment
dockerfile: moldesign-minimal-cache.dockerfile
cached: false # do not cache this! It gets built before the cache is triggered
working_dir: /opt/molecular-design-toolkit/moldesign/_tests
working_dir: /opt/molecular-design-toolkit/
add_docker: true
environment:
TESTENV: minimal
Expand All @@ -37,7 +37,7 @@ test_moldesign_minimal_py2:
context: ./deployment
dockerfile: moldesign-minimal-py2-cache.dockerfile
cached: false # do not cache this! It gets built before the cache is triggered
working_dir: /opt/molecular-design-toolkit/moldesign/_tests
working_dir: /opt/molecular-design-toolkit/
add_docker: true
environment:
TESTENV: minimal
Expand All @@ -51,7 +51,7 @@ test_moldesign_complete:
context: ./deployment
dockerfile: moldesign-complete-cache.dockerfile
cached: false # do not cache this! It gets built before the cache is triggered
working_dir: /opt/molecular-design-toolkit/moldesign/_tests
working_dir: /opt/molecular-design-toolkit/
add_docker: true
environment:
TESTENV: complete
Expand All @@ -65,7 +65,7 @@ test_moldesign_complete_py2:
context: ./deployment
dockerfile: moldesign-complete-py2-cache.dockerfile
cached: false # do not cache this! It gets built before the cache is triggered
working_dir: /opt/molecular-design-toolkit/moldesign/_tests
working_dir: /opt/molecular-design-toolkit/
add_docker: true
environment:
TESTENV: complete
Expand Down
10 changes: 5 additions & 5 deletions codeship-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,22 @@
service: docker_make
command: docker-make --all --tag dev

- command: ../../deployment/codeship_runtests.sh
- command: deployment/codeship_runtests.sh
service: test_moldesign_complete
name: complete_test_py3
- command: ../../deployment/codeship_runtests.sh
- command: deployment/codeship_runtests.sh
service: test_moldesign_minimal
name: minimal_test_py3
- command: ../../deployment/codeship_runtests.sh
- command: deployment/codeship_runtests.sh
service: test_moldesign_complete_py2
name: complete_test_py2
- command: ../../deployment/codeship_runtests.sh
- command: deployment/codeship_runtests.sh
service: test_moldesign_minimal_py2
name: minimal_test_py2

- name: publish
service: publisher
# matches tags that are valid PEP440 versions
tag: '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)((a|rc|b)(0|[1-9]\d*))?$'
command: ./deployment/publish.sh
command: deployment/publish.sh

11 changes: 8 additions & 3 deletions deployment/codeship_runtests.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/usr/bin/env bash
# this script expects to run from the moldesign/_tests directory
# this script expects to run from the root of the repository

# fail immediately if any command fails:
set -e

VERSION="${TESTENV}.py${PYVERSION}"
PYTESTFLAGS="-n 6 --durations=20 --junit-xml=/opt/reports/junit.${VERSION}.xml --timeout=1800"
if [ "${VERSION}" == "complete.py3" ]; then
PYTESTFLAGS="--cov .. --cov-config=./.coveragerc ${PYTESTFLAGS}"
PYTESTFLAGS="--cov moldesign ${PYTESTFLAGS}"
fi


function send_status_update(){
python ../../deployment/send_test_status.py "${1}" "${2}"
python deployment/send_test_status.py "${1}" "${2}"
}


Expand Down Expand Up @@ -54,6 +54,11 @@ function check_if_tests_should_run(){
function run_tests(){
send_status_update "na" "Starting tests for ${VERSION}"

echo
echo "Test command running in working dir '$(pwd)':"
echo "py.test ${PYTESTFLAGS}"
echo

py.test ${PYTESTFLAGS} | tee /opt/reports/pytest.${VERSION}.log
exitstat=${PIPESTATUS[0]}

Expand Down
9 changes: 6 additions & 3 deletions deployment/provision_testrunner_image.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env bash
# Gets image ready to run tests

mkdir -p ~/.moldesign \
&& echo devmode: true >> ~/.moldesign/moldesign.yml \
&& pip install -r ./requirements.txt
set -e

mkdir -p ~/.moldesign
echo devmode: true >> ~/.moldesign/moldesign.yml
pip install -r ./requirements.txt
2 changes: 2 additions & 0 deletions deployment/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Python dependencies for the build/test environment
coveralls
nbformat
pathlib ; python_version < '3.5'
PyGithub
pytest-cov
pytest-xdist != 1.17.0
pytest-timeout

7 changes: 4 additions & 3 deletions moldesign/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
0.8 - WIP
=========
Changes:
- Simultaneous Python 2/3 compatibility
- To make installation easier, we've removed all Jupyter-specific functionality to the
``Autodesk/mdtwidgets`` project (formerly known as ``nbolviz``), which vastly simplifies
MDT's dependencies. To use the notebook visualization utilities, run `pip install mdtwidgets`
which vastly simplifies
MDT's dependencies. To use the notebook visualization utilities, run `pip install nbmolviz`

NEW MODELING FEATURES
- QM/MM
- NWChem QM


0.7.3 - October 17, 2016
Expand Down
1 change: 1 addition & 0 deletions moldesign/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
from . import molecules
from . import tools
from . import widgets
from .widgets import configure, about

# Populate the top-level namespace (imports everything from each <submodule>.__all__ variable)
from .exceptions import *
Expand Down
Loading

0 comments on commit c64d3dc

Please sign in to comment.