【问题标题】:Python library for continuous integration testing用于持续集成测试的 Python 库
【发布时间】:2018-03-01 20:38:26
【问题描述】:

我正在尝试创建一个用于持续集成的测试系统,并且我希望能够进行执行特定操作的检查,例如以特定方式格式化文件,并且这些检查需要有一个流程。

例子:

FormatFilesCheck(files):
    Test(see if formatter is installed)
    for prep in prework:
        Test(do prep)
        for file in files:
            Test(try formatting file)
    Test(clean up work)

我想知道是否有处理测试控制的 python 库。显然有 unittest 但据我所知,这意味着线性测试,即使用依赖项进行测试。

如果 unittest 有这种能力,那么一个例子会很棒。

*edit:我真正想要的是一个框架,它具有类似于 unittest 的错误处理和断言功能,它允许我编写检查并将它们插入其中。

提前感谢

【问题讨论】:

    标签: python continuous-integration integration-testing


    【解决方案1】:

    如果我理解您的要求,那么您正在寻找与 Chai JS 类似的东西。幸运的是,有人编写了一个近似它的 python 库,也称为Chai。你的测试用例看起来像这样:

    FormatFilesCheck(files):
        expect(formatter.status).equals(installed)
        for prep in prework:
            do prep
            expect(prep).equals(what_prep_should_look_like)
            for file in files:
                format file
                expect(file).equals(what_file_should_look_like)
        clean up work
        # your expect/assert statements to make sure everything was cleaned up
    

    【讨论】:

    • 是的,与它类似,只是周围有更多的基础设施来处理故障并注销发生的事情。如果有意义的话,基本上是一个基于非单元的单元测试库。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多