def test_default_path_no_features(self):
        config = Mock()
        config.paths = []
        config.verbose = True
        r = runner.Runner(config)

        fs = FsMock("features/steps/")
        with patch("os.path", fs):
            with patch("os.walk", fs.walk):
                assert_raises(ConfigError, r.setup_paths)
    def test_supplied_feature_directory_missing(self):
        config = Mock()
        config.paths = ["spam"]
        config.verbose = True
        r = runner.Runner(config)

        fs = FsMock()

        with patch("os.path", fs):
            with patch("os.walk", fs.walk):
                assert_raises(ConfigError, r.setup_paths)
    def test_supplied_feature_file_no_steps(self):
        config = Mock()
        config.paths = ["features/group1/foo.feature"]
        config.verbose = True
        r = runner.Runner(config)

        fs = FsMock("features/", "features/group1/", "features/group1/foo.feature")

        with patch("os.path", fs):
            with patch("os.walk", fs.walk):
                with r.path_manager:
                    assert_raises(ConfigError, r.setup_paths)
Example #4
0
    def test_default_path_no_features(self):
        config = Mock()
        config.paths = []
        config.verbose = True
        r = runner.Runner(config)

        fs = FsMock("features/steps/")
        with patch("os.path", fs):
            with patch("os.walk", fs.walk):
                # pylint: disable=E0602
                #   E0602   Undefined variable "assert_raises"
                assert_raises(ConfigError, r.setup_paths)
    def test_supplied_feature_directory_no_steps(self):
        config = Mock()
        config.paths = ["features/group1"]
        config.verbose = True
        r = runner.Runner(config)

        fs = FsMock("features/", "features/group1/", "features/group1/foo.feature")

        with patch("os.path", fs):
            with patch("os.walk", fs.walk):
                assert_raises(ConfigError, r.setup_paths)

        ok_(("isdir", os.path.join(fs.base, "features", "steps")) in fs.calls)
    def test_default_path_no_steps(self):
        config = Mock()
        config.paths = []
        config.verbose = True
        r = runner.Runner(config)

        fs = FsMock()

        # will look for a "features" directory and not find one
        with patch("os.path", fs):
            assert_raises(ConfigError, r.setup_paths)

        ok_(("isdir", os.path.join(fs.base, "features", "steps")) in fs.calls)
Example #7
0
    def test_supplied_feature_directory_missing(self):
        config = Mock()
        config.paths = ["spam"]
        config.verbose = True
        r = runner.Runner(config)

        fs = FsMock()

        with patch("os.path", fs):
            with patch("os.walk", fs.walk):
                # pylint: disable=E0602
                #   E0602   Undefined variable "assert_raises"
                assert_raises(ConfigError, r.setup_paths)
    def test_default_path(self):
        config = Mock()
        config.paths = []
        config.verbose = True
        r = runner.Runner(config)

        fs = FsMock("features/", "features/steps/", "features/group1/", "features/group1/foo.feature")

        with patch("os.path", fs):
            with patch("os.walk", fs.walk):
                with r.path_manager:
                    r.setup_paths()

        eq_(r.base_dir, os.path.abspath("features"))
Example #9
0
    def test_supplied_feature_file_no_steps(self):
        config = Mock()
        config.paths = ["foo.feature"]
        config.verbose = True
        r = runner.Runner(config)

        fs = FsMock("foo.feature")

        with patch("os.path", fs):
            with patch("os.walk", fs.walk):
                with r.path_manager:
                    # pylint: disable=E0602
                    #   E0602   Undefined variable "assert_raises"
                    assert_raises(ConfigError, r.setup_paths)
    def test_supplied_feature_directory(self):
        config = Mock()
        config.paths = ["features/group1"]
        config.verbose = True
        r = runner.Runner(config)

        fs = FsMock("features/", "features/group1/", "features/group1/foo.feature", "features/steps/")

        with patch("os.path", fs):
            with patch("os.walk", fs.walk):
                with r.path_manager:
                    r.setup_paths()

        ok_(("isdir", os.path.join(fs.base, "features", "steps")) in fs.calls)
        eq_(r.base_dir, os.path.join(fs.base, "features"))
Example #11
0
    def test_supplied_feature_directory_no_steps(self):
        config = Mock()
        config.paths = ["spam"]
        config.verbose = True
        r = runner.Runner(config)

        fs = FsMock("spam/", "spam/foo.feature")

        with patch("os.path", fs):
            with patch("os.walk", fs.walk):
                # pylint: disable=E0602
                #   E0602   Undefined variable "assert_raises"
                assert_raises(ConfigError, r.setup_paths)

        ok_(("isdir", os.path.join(fs.base, "spam", "steps")) in fs.calls)
    def test_supplied_feature_file(self):
        config = Mock()
        config.paths = ["foo.feature"]
        config.verbose = True
        r = runner.Runner(config)
        r.context = Mock()

        fs = FsMock("steps/", "foo.feature")

        with patch("os.path", fs):
            with patch("os.walk", fs.walk):
                with r.path_manager:
                    r.setup_paths()
        ok_(("isdir", os.path.join(fs.base, "steps")) in fs.calls)
        ok_(("isfile", os.path.join(fs.base, "foo.feature")) in fs.calls)

        eq_(r.base_dir, fs.base)