Skip to content

Commit

Permalink
add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
soimort committed Feb 12, 2013
1 parent 4aaa73d commit 2b47ccd
Show file tree
Hide file tree
Showing 45 changed files with 57 additions and 36 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/build/
/dist/
/*.egg-info/
/MANIFEST
*.egg-info/
*.py[cod]

_*/
*.py[cod]

*.download
*.cmt.*
Expand Down
21 changes: 0 additions & 21 deletions MANIFEST

This file was deleted.

5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ SETUP = python3 setup.py

default: build sdist bdist bdist_egg

test:
$(SETUP) test

clean:
zenity --question
rm -fr build/ dist/ *.egg-info/
rm -fr build/ dist/ src/*.egg-info/
find . | grep __pycache__ | xargs rm -fr

build:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ In Python 3 (interactive):

>>> import you_get

>>> you_get.__version__
'0.2'
>>> you_get.version.__version__
'0.3'

>>> you_get.youtube_download("http://www.youtube.com/watch?v=8bQlxQJEzLk", info_only = True)
Video Site: YouTube.com
Expand Down
4 changes: 2 additions & 2 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ In Python 3 (interactive)::

>>> import you_get

>>> you_get.__version__
'0.2'
>>> you_get.version.__version__
'0.3'

>>> you_get.youtube_download("http://www.youtube.com/watch?v=8bQlxQJEzLk", info_only = True)
Video Site: YouTube.com
Expand Down
12 changes: 9 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#!/usr/bin/env python3

PROJ_METADATA = 'you-get.json'
PROJ_NAME = 'you-get'
PACKAGE_NAME = 'you_get'

PROJ_METADATA = '%s.json' % PROJ_NAME

import os, json, imp
here = os.path.abspath(os.path.dirname(__file__))
proj_info = json.loads(open(os.path.join(here, PROJ_METADATA)).read())
README = open(os.path.join(here, 'README.txt')).read()
CHANGELOG = open(os.path.join(here, 'CHANGELOG.txt')).read()
VERSION = imp.load_source('version', os.path.join(here, 'you_get/version.py')).__version__
VERSION = imp.load_source('version', os.path.join(here, 'src/%s/version.py' % PACKAGE_NAME)).__version__

from setuptools import setup, find_packages
setup(
Expand All @@ -24,7 +27,10 @@

long_description = README + '\n\n' + CHANGELOG,

packages = find_packages(),
packages = find_packages('src'),
package_dir = {'' : 'src'},

test_suite = 'tests',

platforms = 'any',
zip_safe = False,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions src/you_get/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env python

__version__ = '0.3.1rc'
__date__ = '2013-02-12'
Empty file added tests/__init__.py
Empty file.
32 changes: 32 additions & 0 deletions tests/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import unittest

from you_get import *
from you_get.main import url_to_module

class YouGetTests(unittest.TestCase):

def test_googleplus(self):
for url in [
"http://plus.google.com/111438309227794971277/posts/So6bW37WWtp",
"http://plus.google.com/114038303885145553998/posts/7Jkwa35HZu8",
"http://plus.google.com/109544372058574620997/posts/Hn9P3Mbuyud",
"http://plus.google.com/photos/109544372058574620997/albums/5835145047890484737/5835145057636064194",
"http://plus.google.com/102663035987142737445/posts/jJRu43KQFT5",
"http://plus.google.com/+%E5%B9%B3%E7%94%B0%E6%A2%A8%E5%A5%88/posts/jJRu43KQFT5",
"http://plus.google.com/+平田梨奈/posts/jJRu43KQFT5",
"http://plus.google.com/photos/102663035987142737445/albums/5844078581209509505/5844078587839097874",
"http://plus.google.com/photos/+%E5%B9%B3%E7%94%B0%E6%A2%A8%E5%A5%88/albums/5844078581209509505/5844078587839097874",
"http://plus.google.com/photos/+平田梨奈/albums/5844078581209509505/5844078587839097874",
]:
url_to_module(url).download(url, info_only = True)

def test_mixcloud(self):
for url in [
"http://www.mixcloud.com/beatbopz/beat-bopz-disco-mix/",
"http://www.mixcloud.com/beatbopz/tokyo-taste-vol4/",
"http://www.mixcloud.com/DJVadim/north-america-are-you-ready/",
]:
url_to_module(url).download(url, info_only = True)
2 changes: 1 addition & 1 deletion you-get
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

from you_get import *
from src.you_get import *

if __name__ == "__main__":
main()
4 changes: 0 additions & 4 deletions you_get/version.py

This file was deleted.

0 comments on commit 2b47ccd

Please sign in to comment.