mirror of
https://github.com/kennethreitz-archive/python-build.git
synced 2026-06-05 15:20:16 +00:00
Bug fixed. Added tests.
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import os
|
||||
import shutil
|
||||
|
||||
PYTHONBREW_ROOT = '/tmp/pythonbrew.test'
|
||||
TESTPY_FILE = '/tmp/pythonbrew_test.py'
|
||||
TESTPY_VERSION = '2.6.6'
|
||||
def cleanall():
|
||||
if os.path.isdir(PYTHONBREW_ROOT):
|
||||
shutil.rmtree(PYTHONBREW_ROOT)
|
||||
if os.path.isfile(TESTPY_FILE):
|
||||
os.remove(TESTPY_FILE)
|
||||
|
||||
def setup():
|
||||
os.environ['PYTHONBREW_ROOT'] = PYTHONBREW_ROOT
|
||||
cleanall()
|
||||
fp = open(TESTPY_FILE, 'w')
|
||||
fp.write("print 'test'")
|
||||
fp.close()
|
||||
|
||||
def teardown():
|
||||
cleanall()
|
||||
@@ -0,0 +1,3 @@
|
||||
def test_install_pythonbrew():
|
||||
from pythonbrew.installer import install_pythonbrew
|
||||
install_pythonbrew()
|
||||
@@ -0,0 +1,5 @@
|
||||
def test_update():
|
||||
from pythonbrew.commands.update import UpdateCommand
|
||||
c = UpdateCommand()
|
||||
c.run_command(None, None)
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
def test_help():
|
||||
from pythonbrew.commands.help import HelpCommand
|
||||
c = HelpCommand()
|
||||
c.run_command(None, None)
|
||||
@@ -0,0 +1,4 @@
|
||||
def test_version():
|
||||
from pythonbrew.commands.version import VersionCommand
|
||||
c = VersionCommand()
|
||||
c.run_command(None, None)
|
||||
@@ -0,0 +1,11 @@
|
||||
from tests import TESTPY_VERSION
|
||||
|
||||
class InstallOptions(object):
|
||||
force = True
|
||||
configure = ""
|
||||
no_setuptools = False
|
||||
|
||||
def test_install():
|
||||
from pythonbrew.commands.install import InstallCommand
|
||||
c = InstallCommand()
|
||||
c.run_command(InstallOptions(), [TESTPY_VERSION])
|
||||
@@ -0,0 +1,6 @@
|
||||
from tests import TESTPY_VERSION
|
||||
|
||||
def test_switch():
|
||||
from pythonbrew.commands.switch import SwitchCommand
|
||||
c = SwitchCommand()
|
||||
c.run_command(None, [TESTPY_VERSION])
|
||||
@@ -0,0 +1,6 @@
|
||||
from tests import TESTPY_VERSION
|
||||
|
||||
def test_use():
|
||||
from pythonbrew.commands.use import UseCommand
|
||||
c = UseCommand()
|
||||
c.run_command(None, [TESTPY_VERSION])
|
||||
@@ -0,0 +1,4 @@
|
||||
def test_off():
|
||||
from pythonbrew.commands.off import OffCommand
|
||||
c = OffCommand()
|
||||
c.run_command(None, None)
|
||||
@@ -0,0 +1,8 @@
|
||||
class ListOptions(object):
|
||||
all_versions = False
|
||||
known = False
|
||||
|
||||
def test_list():
|
||||
from pythonbrew.commands.list import ListCommand
|
||||
c = ListCommand()
|
||||
c.run_command(ListOptions(), None)
|
||||
@@ -0,0 +1,10 @@
|
||||
from tests import TESTPY_FILE
|
||||
|
||||
class PyOptions(object):
|
||||
pythons = []
|
||||
verbose = False
|
||||
|
||||
def test_py():
|
||||
from pythonbrew.commands.py import PyCommand
|
||||
c = PyCommand()
|
||||
c.run_command(PyOptions(), [TESTPY_FILE])
|
||||
@@ -0,0 +1,6 @@
|
||||
from tests import TESTPY_VERSION
|
||||
|
||||
def test_uninstall():
|
||||
from pythonbrew.commands.uninstall import UninstallCommand
|
||||
c = UninstallCommand()
|
||||
c.run_command(None, [TESTPY_VERSION])
|
||||
@@ -0,0 +1,4 @@
|
||||
def test_clean():
|
||||
from pythonbrew.commands.clean import CleanCommand
|
||||
c = CleanCommand()
|
||||
c.run_command(None, None)
|
||||
Reference in New Issue
Block a user