Permalink
Browse files

fix directions for running tests (to use python -m)

  • Loading branch information...
1 parent a444283 commit d5bc9e5d30e0a68360f3efae33b7e32e90b0206e @simon-weber committed Apr 15, 2013
Showing with 19 additions and 30 deletions.
  1. +1 −1 .travis.yml
  2. +9 −9 CONTRIBUTING.md
  3. +1 −1 docs/source/usage.rst
  4. +8 −19 gmusicapi/test/utils.py
View
@@ -6,7 +6,7 @@ python:
install:
- python setup.py sdist --formats=zip -k
- find ./dist -iname "*.zip" -print0 | xargs -0 pip install
-script: "python gmusicapi/test/run_tests.py"
+script: "python -m gmusicapi.test.run_tests"
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq libav-tools libavcodec-extra-53
View
@@ -17,12 +17,12 @@ One exception: the docs are built dynamically against the current state of `mast
### Checking out a dev environment
You can do this however you like, but generally you want to use [virtualenv](http://www.virtualenv.org/en/latest/):
-* `git clone https://github.com/simon-weber/Unofficial-Google-Music-API.git`
-* `cd Unofficial-Google-Music-API/`
-* `virtualenv --no-site-packages venv-gmapi`
-* `source venv-gmapi/bin/activate`
-* `pip install -e .` this installs the package as editable; changes to the source are reflected when running
-* `git checkout develop`
-* hack away
-* `python gmusicapi/test/run_tests.py`
-* `deactivate` when you're finished
+* `$ git clone https://github.com/simon-weber/Unofficial-Google-Music-API.git`
+* `$ cd Unofficial-Google-Music-API/`
+* `$ virtualenv --no-site-packages venv-gmapi`
+* `$ source venv-gmapi/bin/activate`
+* `$ pip install -e .` # this installs the package as editable; changes to the source are reflected when running
+* `$ git checkout develop`
+* # hack away
+* `$ python -m gmusicapi.test.run_tests`
+* `$ deactivate` # when you're finished
View
@@ -28,7 +28,7 @@ If you need to install avconv from source, be sure to use
``$ ./configure --enable-gpl --enable-nonfree --enable-libmp3lame``.
To check that everything is set up correctly, you can run the test
-suite: ``$ python gmusicapi/test/run_tests.py``.
+suite: ``$ python -m gmusicapi.test.run_tests``.
If something goes horribly wrong there's the chance you'll end up
with an extra test playlist or song in your library, but you
should never lose anything.
View
@@ -8,8 +8,6 @@
import numbers
import os
import re
-import string
-import sys
#from gmusicapi.api import Api
@@ -26,28 +24,19 @@
("{h}{{4}}-" * 3) +
"{h}{{12}}").format(h=hex_set))
-#Test files are located in the same directory as this file.
+#Get the absolute paths of the test files, which are located in the same
+# directory as this file.
cwd = os.getcwd()
-os.chdir(os.path.dirname(sys.argv[0]))
+test_file_dir = os.path.dirname(os.path.abspath(__file__))
+os.chdir(test_file_dir)
-audio_filenames = glob(u'audiotest*')
-mp3_filenames = [fn for fn in audio_filenames if fn.endswith('.mp3')]
-small_mp3 = u'audiotest_small.mp3'
-image_filename = 'imagetest_10x10_check.png'
+_audio_filenames = glob(u'audiotest*')
+mp3_filenames = [os.path.abspath(fn) for fn in _audio_filenames if fn.endswith('.mp3')]
+small_mp3 = os.path.abspath(u'audiotest_small.mp3')
+image_filename = os.path.abspath(u'imagetest_10x10_check.png')
os.chdir(cwd)
-#Get the full path of the test files.
-#Can't use abspath since this is relative to where _this_ file is,
-# not necessarily the calling curdir.
-path = os.path.realpath(__file__)
-real_path = lambda lp: path[:string.rfind(path, os.sep)] + os.sep + lp
-
-mp3_filenames = map(real_path, mp3_filenames)
-audio_filenames = map(real_path, audio_filenames)
-image_filename = real_path(image_filename)
-small_mp3 = real_path(small_mp3)
-
class NoticeLogging(logging.Handler):
"""A log handler that, if asked to emit, will set

0 comments on commit d5bc9e5

Please sign in to comment.