SyntaxError:无效语法noseOfYeti - >在它声明

时间:2016-06-13 22:04:09

标签: python python-2.7 nose

我已开始使用noseOfYeti插件进行nosetests。到目前为止它运作良好;它一直存在的问题是我在测试中添加了“before_each:”部分。这是我的代码:

# coding: spec    

from .context import get_elbs

from nose.tools import set_trace; 
from unittest import TestCase

describe TestCase, "Initialize":

    it "creates a GetELBs object":
        mock_aws_connection = ''
        elb_finder = get_elbs.GetElbs(mock_aws_connection)
        self.assertIsInstance(elb_finder, get_elbs.GetElbs)

    describe "get_account_elbs":
        before_each:
            pass

        it "returns a list of elbs":
            pass

和我运行的命令:

nosetests --with-noy

输出:

D:\dev\git_repos\platform-health>nosetests --with-noy
E
======================================================================
ERROR: Failure: SyntaxError (invalid syntax (test_get_elbs.py, line 19))
----------------------------------------------------------------------
Traceback (most recent call last):
  File "d:\apps\python\python27\lib\site-packages\nose\loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "d:\apps\python\python27\lib\site-packages\nose\importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "d:\apps\python\python27\lib\site-packages\nose\importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "D:\dev\git_repos\platform-health\tests\unit_tests\test_orphan_elb_finder\test_get_elbs.py", line 19
    it "returns a list of elbs":
                              ^
SyntaxError: invalid syntax

----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)

我在这里关注文档:

https://noseofyeti.readthedocs.io/en/latest/examples.html

我的语法看起来一样,所以我不能为我的生活弄清楚为什么它不起作用。

0 个答案:

没有答案