arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2305.13486cs.SE
收藏

pytest-inline:一个用于Python的内联测试工具

pytest-inline: An Inline Testing Tool for Python

Yu Liu, Zachary Thurston, Alan Han, Pengyu Nie, Milos Gligoric, Owolabi Legunsen

AI总结:

本文提出了首个Python内联测试框架pytest-inline,作为pytest插件支持开发者通过指定输入和预期输出测试单个语句,在31个项目的80个语句评估中开销仅0.012倍。

摘要:

我们提出了pytest-inline,这是首个用于Python的内联测试框架。我们最近提出了内联测试,以使其更容易测试单个程序语句。但是,目前没有框架级别的支持供开发者在Python中编写内联测试。为了填补这一空白,我们设计并实现了pytest-inline,作为最流行的Python测试框架pytest的插件。使用pytest-inline,开发者可以通过将测试输入分配给目标语句中的变量并指定预期的测试输出来编写内联测试。然后,pytest-inline运行每个内联测试,如果目标语句的输出与预期输出不匹配,则测试失败。在本文中,我们描述了pytest-inline的设计、它提供的测试功能以及预期的用例。我们对为31个开源Python项目中的80个目标语句编写的内联测试进行了评估,结果显示使用pytest-inline产生的开销可以忽略不计,为0.012倍。pytest-inline已集成到pytest-dev组织中,视频演示位于https://www.youtube.com/watch?v=pZgiAxR_uJg。

英文摘要:

We present pytest-inline, the first inline testing framework for Python. We recently proposed inline tests to make it easier to test individual program statements. But, there is no framework-level support for developers to write inline tests in Python. To fill this gap, we design and implement pytest-inline as a plugin for pytest, the most popular Python testing framework. Using pytest-inline, a developer can write an inline test by assigning test inputs to variables in a target statement and specifying the expected test output. Then, pytest-inline runs each inline test and fails if the target statement's output does not match the expected output. In this paper, we describe our design of pytest-inline, the testing features that it provides, and the intended use cases. Our evaluation on inline tests that we wrote for 80 target statements from 31 open-source Python projects shows that using pytest-inline incurs negligible overhead, at 0.012x. pytest-inline is integrated into the pytest-dev organization, and a video demo is at https://www.youtube.com/watch?v=pZgiAxR_uJg.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑