Skip to content

Commit

Permalink
add testing framework, .gitignore (#1)
Browse files Browse the repository at this point in the history
* add testing framework, .gitignore

* fix cvxopt
  • Loading branch information
bqpd authored and priyappillai committed Sep 10, 2019
1 parent 2d480ee commit d1b66f9
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 27 deletions.
78 changes: 78 additions & 0 deletions .gitignore
@@ -0,0 +1,78 @@
# iPython checkpoint folders
.ipynb_checkpoints/

# Pickled solutions
*.p

# MOSEK CLI folder
gpkit_tmp/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
bin/
build/
develop-eggs/
dist/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

# Rope
.ropeproject

# Django stuff:
*.log
*.pot

# Sphinx documentation
docs/_build/

# MATLAB autosave
*.asv

# CI test xmloutput
test_reports/
test_reports_nounits/

# MacOSX
*.DS_Store

# vim
*.swp

# OSX
.DS_Store
55 changes: 28 additions & 27 deletions FeasibilityDemo.py
Expand Up @@ -78,30 +78,31 @@ def plot_feasibility_simple_Wing(type_of_uncertainty_set, x, y, str1, val1, str2
del y.key.descr[str2]


# plot_feasibility_simple_Wing('elliptical', W_0, W_W_coeff2, 'r', 1.6, 'r', 1.66, True)
# plot_feasibility_simple_Wing('elliptical', W_0, W_W_coeff2, 'r', 1.6, 'r', 1.66, False)
# plot_feasibility_simple_Wing('box', W_0, W_W_coeff2, 'pr', 60, 'pr', 66, True)
# plot_feasibility_simple_Wing('box', W_0, W_W_coeff2, 'pr', 60, 'pr', 66, False)

# plot_feasibility_simple_Wing('elliptical', W_W_coeff1, W_W_coeff2, 'r', 1.6, 'r', 1.66, True)
# plot_feasibility_simple_Wing('elliptical', W_W_coeff1, W_W_coeff2, 'r', 1.6, 'r', 1.66, False)
# plot_feasibility_simple_Wing('box', W_W_coeff1, W_W_coeff2, 'pr', 60, 'pr', 66, True)
# plot_feasibility_simple_Wing('box', W_W_coeff1, W_W_coeff2, 'pr', 60, 'pr', 66, False)

plot_feasibility_simple_Wing('elliptical', C_Lmax, V_min, 'r', 1.25, 'r', 1.2)
plot_feasibility_simple_Wing('box', C_Lmax, V_min, 'pr', 25, 'pr', 20)

# plot_feasibility_simple_Wing('elliptical', dummy, e, 'r', 1.12, 'r', 1.31, True)
# plot_feasibility_simple_Wing('elliptical', dummy, e, 'r', 1.12, 'r', 1.31, False)
# plot_feasibility_simple_Wing('box', dummy, e, 'pr', 12, 'pr', 31, True)
# plot_feasibility_simple_Wing('box', dummy, e, 'pr', 12, 'pr', 31, False)

# plot_feasibility_simple_Wing('elliptical', rho, dummy, 'r', 1.1, 'r', 1.12, True)
# plot_feasibility_simple_Wing('elliptical', rho, dummy, 'r', 1.1, 'r', 1.12, False)
# plot_feasibility_simple_Wing('box', rho, dummy, 'pr', 10, 'pr', 12, True)
# plot_feasibility_simple_Wing('box', rho, dummy, 'pr', 10, 'pr', 12, False)

# plot_feasibility_simple_Wing('elliptical', rho, W_0, 'r', 1.1, 'r', 1.6, True)
# plot_feasibility_simple_Wing('elliptical', rho, W_0, 'r', 1.1, 'r', 1.6, False)
# plot_feasibility_simple_Wing('box', rho, W_0, 'r', 1.1, 'r', 1.6, True)
# plot_feasibility_simple_Wing('box', rho, W_0, 'r', 1.1, 'r', 1.6, False)
if __name__ == "__main__":
# plot_feasibility_simple_Wing('elliptical', W_0, W_W_coeff2, 'r', 1.6, 'r', 1.66, True)
# plot_feasibility_simple_Wing('elliptical', W_0, W_W_coeff2, 'r', 1.6, 'r', 1.66, False)
# plot_feasibility_simple_Wing('box', W_0, W_W_coeff2, 'pr', 60, 'pr', 66, True)
# plot_feasibility_simple_Wing('box', W_0, W_W_coeff2, 'pr', 60, 'pr', 66, False)

# plot_feasibility_simple_Wing('elliptical', W_W_coeff1, W_W_coeff2, 'r', 1.6, 'r', 1.66, True)
# plot_feasibility_simple_Wing('elliptical', W_W_coeff1, W_W_coeff2, 'r', 1.6, 'r', 1.66, False)
# plot_feasibility_simple_Wing('box', W_W_coeff1, W_W_coeff2, 'pr', 60, 'pr', 66, True)
# plot_feasibility_simple_Wing('box', W_W_coeff1, W_W_coeff2, 'pr', 60, 'pr', 66, False)

plot_feasibility_simple_Wing('elliptical', C_Lmax, V_min, 'r', 1.25, 'r', 1.2)
plot_feasibility_simple_Wing('box', C_Lmax, V_min, 'pr', 25, 'pr', 20)

# plot_feasibility_simple_Wing('elliptical', dummy, e, 'r', 1.12, 'r', 1.31, True)
# plot_feasibility_simple_Wing('elliptical', dummy, e, 'r', 1.12, 'r', 1.31, False)
# plot_feasibility_simple_Wing('box', dummy, e, 'pr', 12, 'pr', 31, True)
# plot_feasibility_simple_Wing('box', dummy, e, 'pr', 12, 'pr', 31, False)

# plot_feasibility_simple_Wing('elliptical', rho, dummy, 'r', 1.1, 'r', 1.12, True)
# plot_feasibility_simple_Wing('elliptical', rho, dummy, 'r', 1.1, 'r', 1.12, False)
# plot_feasibility_simple_Wing('box', rho, dummy, 'pr', 10, 'pr', 12, True)
# plot_feasibility_simple_Wing('box', rho, dummy, 'pr', 10, 'pr', 12, False)

# plot_feasibility_simple_Wing('elliptical', rho, W_0, 'r', 1.1, 'r', 1.6, True)
# plot_feasibility_simple_Wing('elliptical', rho, W_0, 'r', 1.1, 'r', 1.6, False)
# plot_feasibility_simple_Wing('box', rho, W_0, 'r', 1.1, 'r', 1.6, True)
# plot_feasibility_simple_Wing('box', rho, W_0, 'r', 1.1, 'r', 1.6, False)
35 changes: 35 additions & 0 deletions tests.py
@@ -0,0 +1,35 @@
import unittest
import matplotlib as mpl
mpl.use('Agg') # has to be called before matplotlib.pyplot is imported

from gpkit import settings
import gpkit.tests
from FeasibilityDemo import plot_feasibility_simple_Wing, C_Lmax, V_min


class TestFeasibilityDemo(unittest.TestCase):
"""test for the feasibility plots demo"""

def test_elliptical(self):
if settings["default_solver"] == "cvxopt":
return
plot_feasibility_simple_Wing('elliptical', C_Lmax, V_min,
'r', 1.25, 'r', 1.2)

def test_box(self):
if settings["default_solver"] == "cvxopt":
return
plot_feasibility_simple_Wing('box', C_Lmax, V_min,
'pr', 25, 'pr', 20)


TESTS = [TestFeasibilityDemo]


def run(xmloutput=False, verbosity=1):
"run design space visualization tests"
gpkit.tests.run(tests=TESTS, xmloutput=xmloutput, verbosity=verbosity)


if __name__ == "__main__":
run()

0 comments on commit d1b66f9

Please sign in to comment.