Skip to content

Commit

Permalink
Merge pull request #2671 from blink1073/test-imports
Browse files Browse the repository at this point in the history
Test module importing on Travis
  • Loading branch information
ccordoba12 committed Oct 8, 2015
2 parents 13d34aa + 160c83b commit 0a9353c
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,5 @@ install:

script:
- python bootstrap.py --test-travis 30

- python setup.py install
- ./continuous_integration/travis_script.sh
51 changes: 51 additions & 0 deletions continuous_integration/travis_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bash

set -ex

for f in spyderlib/*.py; do
if [[ $f == "spyderlib/restart_app.py" ]]; then
continue
fi
if [[ $f == "spyderlib/spyder.py" ]]; then
continue
fi
if [[ $f == "spyderlib/tour.py" ]]; then
continue
fi
if [[ $f == "spyderlib/start_app.py" ]]; then
continue
fi
if [[ $f == "spyderlib/pil_patch.py" ]]; then
continue
fi
python "$f"
if [ $? -ne 0 ]; then
exit 1
fi
done


for f in spyderlib/*/*.py; do
if [[ $f == spyderlib/plugins/*.py ]]; then
continue
fi
if [[ $f == spyderlib/qt/*.py ]]; then
continue
fi
if [[ $f == spyderlib/utils/environ.py ]]; then
continue
fi
if [[ $f == spyderlib/utils/qthelpers.py ]]; then
continue
fi
if [[ $f == spyderlib/utils/windows.py ]]; then
continue
fi
if [[ $f == spyderlib/widgets/*.py ]]; then
continue
fi
python "$f"
if [ $? -ne 0 ]; then
exit 1
fi
done
4 changes: 1 addition & 3 deletions spyderlib/utils/bsdsocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,11 @@ class PacketNotReceived(object):
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect( address )

client.send("data to be catched")
client.send("data to be catched".encode('utf-8'))
# accepted server socket is the one we can read from
# note that it is different from server socket
accsock, addr = server.accept()
print('..got "%s" from %s' % (accsock.recv(4096), addr))
client.send("more data for recv")
print('..got "%s" from %s' % (accsock.recv(4096), addr))

# accsock.close()
# client.send("more data for recv")
Expand Down
1 change: 0 additions & 1 deletion spyderlib/utils/environ.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from spyderlib.config.base import _
from spyderlib.widgets.varexp.collectionseditor import CollectionsEditor


def envdict2listdict(envdict):
"""Dict --> Dict of lists"""
sep = os.path.pathsep
Expand Down
20 changes: 14 additions & 6 deletions spyderlib/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,17 @@ def get_common_path(pathlist):
return osp.abspath(common)

if __name__ == '__main__':
assert get_common_path([
'D:\\Python\\spyder-v21\\spyderlib\\widgets',
'D:\\Python\\spyder\\spyderlib\\utils',
'D:\\Python\\spyder\\spyderlib\\widgets',
'D:\\Python\\spyder-v21\\spyderlib\\utils',
]) == 'D:\\Python'
if os.name == 'nt':
assert get_common_path([
'D:\\Python\\spyder-v21\\spyderlib\\widgets',
'D:\\Python\\spyder\\spyderlib\\utils',
'D:\\Python\\spyder\\spyderlib\\widgets',
'D:\\Python\\spyder-v21\\spyderlib\\utils',
]) == 'D:\\Python'
else:
assert get_common_path([
'/Python/spyder-v21/spyderlib/widgets',
'/Python/spyder/spyderlib/utils',
'/Python/spyder/spyderlib/widgets',
'/Python/spyder-v21/spyderlib/utils',
]) == '/Python'
4 changes: 2 additions & 2 deletions spyderlib/utils/sourcecode.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ def get_identifiers(source_code):
if __name__ == '__main__':
code = 'import functools\nfunctools.partial'
assert get_primary_at(code, len(code)) == 'functools.partial'
assert get_identifiers(code) == ['import', 'functools',
'functools.partial']
assert set(get_identifiers(code)) == set(['import', 'functools',
'functools.partial'])
assert split_source(code) == ['import functools', 'functools.partial']
code = code.replace('\n', '\r\n')
assert split_source(code) == ['import functools', 'functools.partial']

0 comments on commit 0a9353c

Please sign in to comment.