本文整理汇总了Python中lettuce.fs.FileSystem类的典型用法代码示例。如果您正苦于以下问题:Python FileSystem类的具体用法?Python FileSystem怎么用?Python FileSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FileSystem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_failfast
def test_failfast():
'passing --failfast to the harvest command will cause lettuce to stop in the first failure'
FileSystem.pushd(current_directory, "django", "celeries")
status, output = commands.getstatusoutput("python manage.py harvest --verbosity=3 --failfast")
the(output).should.contain("This one is present")
the(output).should.contain("Celeries before all")
the(output).should.contain("Celeries before harvest")
the(output).should.contain("Celeries before feature 'Test the django app leaves'")
the(output).should.contain("Celeries before scenario 'This one is present'")
the(output).should.contain("Celeries before step 'Given I say foo bar'")
the(output).should.contain("Celeries after step 'Given I say foo bar'")
the(output).should.contain("Celeries before step 'Then it fails'")
the(output).should.contain("Celeries after step 'Then it fails'")
the(output).should.contain("Celeries after scenario 'This one is present'")
the(output).should.contain("Celeries after feature 'Test the django app leaves'")
the(output).should.contain("Celeries after harvest")
the(output).should.contain("Celeries after all")
the(output).should_not.contain("This one is never called")
FileSystem.popd()
示例2: test_django_admin_media_serving_on_django_125
def test_django_admin_media_serving_on_django_125():
'lettuce should serve admin static files properly on Django 1.2.5'
os.environ['PYTHONPATH'] = "%s:%s" % (
FileSystem.join(lib_directory, 'Django-1.2.5'),
OLD_PYTHONPATH,
)
FileSystem.pushd(current_directory, "django", "grocery")
status, out = commands.getstatusoutput(
"python manage.py harvest --verbosity=2 ./features/")
assert_equals(status, 0, out)
FileSystem.popd()
lines = out.splitlines()
f = '\n\n'
f += '*' * 100
f += '\n' + '\n'.join(lines)
assert u"Preparing to serve django's admin site static files..." in lines, f
assert u"Django's builtin server is running at 0.0.0.0:7000" in lines, f
assert u'Running on port 7000 ... OK' in lines, f
assert u'Fetching admin media ... OK' in lines, f
assert u'Fetching static files ... OK' in lines, f
assert u'Fetching CSS files: ... OK' in lines, f
assert u'Fetching javascript files: ... OK' in lines, f
示例3: test_django_admin_media_serving_forced_by_setting
def test_django_admin_media_serving_forced_by_setting():
'settings.LETTUCE_SERVE_ADMIN_MEDIA forces lettuce to serve admin assets'
os.environ['PYTHONPATH'] = "%s:%s" % (
FileSystem.join(lib_directory, 'Django-1.3'),
OLD_PYTHONPATH,
)
FileSystem.pushd(current_directory, "django", "grocery")
extra_args = " --scenarios=1,3,4,5 --settings=settings_without_admin"
status, out = commands.getstatusoutput(
"python manage.py harvest --verbosity=2 ./features/ %s" % extra_args)
assert_equals(status, 0, out)
FileSystem.popd()
lines = out.splitlines()
assert u"Preparing to serve django's admin site static files " \
"(as per settings.LETTUCE_SERVE_ADMIN_MEDIA=True)..." in lines
assert u'Running on port 7000 ... OK' in lines
assert u'Fetching static files ... OK' in lines
assert u'Fetching CSS files: ... OK' in lines
assert u'Fetching javascript files: ... OK' in lines
assert u"Django's builtin server is running at 0.0.0.0:7000" in lines
# the scenario 2 is not suppose to run
assert u'Fetching admin media ... OK' not in lines
示例4: test_non_recursive_locate
def test_non_recursive_locate():
fs = FileSystem()
files = fs.locate(path=abspath(join(dirname(__file__), "files_to_locate")), match="*.txt", recursive=False)
assert files
assert isinstance(files, list)
assert len(files) == 1
assert split(files[0])[-1] == "test.txt"
示例5: test_server_threading
def test_server_threading():
"""
Test django httpd threading
"""
FileSystem.pushd(current_directory, "django", "coconut")
status, out = commands.getstatusoutput(
"python manage.py harvest --verbosity=1")
assert_equals(status, 0, out)
示例6: test_no_server
def test_no_server():
'"harvest" --no-server does not start the server'
FileSystem.pushd(current_directory, "django", "alfaces")
status, out = commands.getstatusoutput("python manage.py harvest --verbosity=3 --apps=foobar --no-server")
assert_equals(status, 0, out)
assert "Django's builtin server is running at" not in out
示例7: test_django_agains_alfaces
def test_django_agains_alfaces():
'running the "harvest" django command with verbosity 3'
FileSystem.pushd(current_directory, "django", "alfaces")
status, out = commands.getstatusoutput("python manage.py harvest --verbosity=3")
assert_equals(status, 0)
FileSystem.popd()
示例8: test_harvest_sets_environment_variabled_for_gae
def test_harvest_sets_environment_variabled_for_gae():
'harvest sets environment variables SERVER_NAME and SERVER_PORT in order to work with google app engine'
FileSystem.pushd(current_directory, "django", "brocolis")
status, out = commands.getstatusoutput("python manage.py harvest leaves/features/appengine.feature")
assert_equals(status, 0, out)
FileSystem.popd()
示例9: test_harvest_with_debug_mode_disabled
def test_harvest_with_debug_mode_disabled():
'python manage.py harvest without turns settings.DEBUG=False'
FileSystem.pushd(current_directory, "django", "brocolis")
status, out = commands.getstatusoutput("python manage.py harvest leaves/features/disabled.feature")
assert_equals(status, 0, out)
FileSystem.popd()
示例10: test_model_creation
def test_model_creation():
'Models are created through Lettuce steps'
FileSystem.pushd(current_directory, "django", "dill")
status, out = commands.getstatusoutput(
"python manage.py harvest -T leaves/features/create.feature")
assert_equals(status, 0, out)
FileSystem.popd()
示例11: test_django_agains_couves
def test_django_agains_couves():
'it always call @after.all hooks, even after exceptions'
FileSystem.pushd(current_directory, "django", "couves")
status, out = commands.getstatusoutput("python manage.py harvest --verbosity=3")
assert "Couves before all" in out
assert "Couves after all" in out
FileSystem.popd()
示例12: test_django_no_test_database_option
def test_django_no_test_database_option():
'test whether no test database is used if not wanted'
FileSystem.pushd(current_directory, "django", "grocery")
status, out = commands.getstatusoutput("python manage.py harvest --verbosity=2 --no-test-database ./features/")
assert_equals(status, 0)
FileSystem.popd()
assert_equals(re.match(r".*Creating test database for alias '\w+'\.\.\..*",out), None)
示例13: test_django_against_cucumber_django_project
def test_django_against_cucumber_django_project():
'testing all django hooks'
FileSystem.pushd(current_directory, "django", "cucumber")
status, out = commands.getstatusoutput("python manage.py harvest --verbosity=1")
assert "before harvest" in out
assert "after harvest" in out
FileSystem.popd()
示例14: test_running_all_apps_but_lettuce_avoid_apps
def test_running_all_apps_but_lettuce_avoid_apps():
'running the "harvest" will run all apps but those within LETTUCE_AVOID_APPS'
FileSystem.pushd(current_directory, "django", "alfaces")
status, out = commands.getstatusoutput("python manage.py harvest --settings=allbutfoobarsettings --verbosity=3")
assert_equals(status, 0, out)
assert "Test the django app FOO BAR" not in out
assert "Test the django app DO NOTHING" in out
FileSystem.popd()
示例15: test_running_only_apps_within_lettuce_apps_setting
def test_running_only_apps_within_lettuce_apps_setting():
'running the "harvest" will run only on configured apps if the setting LETTUCE_APPS is set'
FileSystem.pushd(current_directory, "django", "alfaces")
status, out = commands.getstatusoutput("python manage.py harvest --settings=onlyfoobarsettings --verbosity=3")
assert_equals(status, 0, out)
assert "Test the django app FOO BAR" in out
assert "Test the django app DO NOTHING" not in out
FileSystem.popd()