0

これは本当にばかげているかもしれませんが、動作させることができません... Linux の python 2.7 でsuchDLSを使用したいと考えています。ドキュメントhttp://nose2.readthedocs.org/en/latest/such_dsl.htmlnose2 (以下のコードを参照)から例の最初を試していますが、どのように起動してもテストは実行されませんコマンドラインから。

私のファイルは test_something.py と呼ばれ、ディレクトリ内の唯一のファイルです。コマンド ラインから>> nose2andを使用して実行しようとしまし>> nose2 --plugin nose2.plugins.layersたが、常にRan 0 tests in 0.000s. と>> nose2 --plugin layers私は得るImportError: No module named layers

コマンドラインからこのテストを実行するにはどうすればよいですか?? ありがとう!

以下のコード:

import unittest
from nose2.tools import such

with such.A("system with complex setup") as it:
    @it.has_setup
    def setup():
        print "Setup"
        it.things = [1]

    @it.has_teardown
    def teardown():
        print "Teardown"
        it.things = []

    @it.should("do something")
    def test():
        print "Test"
        assert it.things
        it.assertEqual(len(it.things), 1)
4

1 に答える 1

0

ドー!it.createTests(globals())ファイルの最後に追加するのを忘れていました!

于 2016-01-14T15:30:58.700 に答える