Skip to content
This repository has been archived by the owner on Feb 9, 2021. It is now read-only.

Commit

Permalink
Merge b9c0ea9 into 97521c5
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-urbanczyk committed Feb 7, 2018
2 parents 97521c5 + b9c0ea9 commit a77a4e3
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 26 deletions.
48 changes: 34 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,50 @@
language: python

matrix:
include:
- python: 2.7
- python: 3.6
env: FREECAD_LIB="$HOME/miniconda/envs/freecad_cq3/lib/"

before_install:
- sudo add-apt-repository -y ppa:freecad-maintainers/freecad-stable
- sudo apt-get update -qq
- if [[ "$TRAVIS_PYTHON_VERSION" == "3.6" ]]; then
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
bash miniconda.sh -b -p $HOME/miniconda;
export PATH="$HOME/miniconda/bin:$PATH";
hash -r;
conda config --set always_yes yes --set changeps1 no;
conda update -q conda;
conda info -a;
conda create -y -q -n freecad_cq3 -c freecad -c conda-forge freecad=0.17 python=3.6 pyparsing conda mock;
source ~/miniconda/bin/activate freecad_cq3;
else
sudo add-apt-repository -y ppa:freecad-maintainers/freecad-stable;
sudo apt-get update -qq;
sudo apt-get install -y freecad freecad-doc;
pip install -r requirements-dev.txt;
pip install travis-sphinx;
pip install sphinx_rtd_theme;
fi

install:
- sudo apt-get install -y freecad freecad-doc
- gcc --version
- g++ --version
- python ./setup.py install
- pip install -r requirements-dev.txt
- pip install travis-sphinx
- pip install sphinx_rtd_theme
- python setup.py install;

script:
- coverage run --source=cadquery ./runtests.py
- travis-sphinx build --nowarn --source=doc
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
coverage run --source=cadquery ./runtests.py;
travis-sphinx build --nowarn --source=doc;
fi
- python runtests.py

after_success:
after_script:
- coveralls
- travis-sphinx deploy

branches:
except:
- pythonocc
- 2_0_branch

deploy:
deploy:
provider: pypi
user: dcowden
password:
Expand Down
4 changes: 2 additions & 2 deletions cadquery/freecad_impl/exporters.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def exportShape(shape,exportType,fileLike,tolerance=0.1):
else:
raise ValueError("No idea how i got here")

res = readAndDeleteFile(outFileName)
res = '{}'.format(readAndDeleteFile(outFileName))
fileLike.write(res)

def readAndDeleteFile(fileName):
Expand Down Expand Up @@ -161,7 +161,7 @@ def writeAmf(self,outFile):
v3 = ET.SubElement(triangle,'v3')
v3.text = str(t[2])

ET.ElementTree(amf).write(outFile,encoding="unicode",xml_declaration=True)
ET.ElementTree(amf).write(outFile,xml_declaration=True)

"""
Objects that represent
Expand Down
5 changes: 4 additions & 1 deletion runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestExporters.TestExporters))
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestImporters.TestImporters))
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestLogging.TestLogging))
unittest.TextTestRunner().run(suite)

if __name__ == '__main__':
result = unittest.TextTestRunner().run(suite)
sys.exit(not result.wasSuccessful())
4 changes: 2 additions & 2 deletions tests/TestCQGI.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def test_build_with_exception(self):
result = model.build({})
self.assertFalse(result.success)
self.assertIsNotNone(result.exception)
self.assertTrue(result.exception.message == "ERROR")
self.assertTrue(result.exception.args[0] == "ERROR")

def test_that_invalid_syntax_in_script_fails_immediately(self):
badscript = textwrap.dedent(
Expand All @@ -114,7 +114,7 @@ def test_that_invalid_syntax_in_script_fails_immediately(self):
with self.assertRaises(Exception) as context:
model = cqgi.CQModel(badscript)

self.assertTrue('invalid syntax' in context.exception)
self.assertTrue('invalid syntax' in context.exception.args)

def test_that_two_results_are_returned(self):
script = textwrap.dedent(
Expand Down
23 changes: 16 additions & 7 deletions tests/TestExporters.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""
Tests basic workplane functionality
"""
#from __future__ import unicode_literals

#core modules
import io

Expand All @@ -18,13 +20,20 @@ def _exportBox(self,eType,stringsToFind):
returns the result in case the case wants to do more checks also
"""
p = Workplane("XY").box(1,2,3)
s = io.StringIO()
exporters.exportShape(p,eType,s,0.1)

result = s.getvalue()
#print result
for q in stringsToFind:
self.assertTrue(result.find(q) > -1 )

if eType == exporters.ExportTypes.AMF:
s = io.BytesIO()
exporters.exportShape(p,eType,s,0.1)
result = s.getvalue()
for q in stringsToFind:
self.assertTrue(result.decode().find(q) > -1 )
else:
s = io.StringIO()
exporters.exportShape(p,eType,s,0.1)
result = s.getvalue()
for q in stringsToFind:
self.assertTrue(result.find(q) > -1 )

return result

def testSTL(self):
Expand Down

0 comments on commit a77a4e3

Please sign in to comment.