Unittest and pytest are the most popular testing frameworks in Python. Overall, pytest provides some advantages, including simpler assertion, reuse of fixtures, and interoperability. Due to such benefits, multiple projects in the Python ecosystem have migrated from unittest to pytest. To facilitate the migration, pytest can also run unittest tests, thus, the migration can happen gradually over time. However, the migration can be time-consuming and take a long time to conclude. In this context, projects would benefit from automated solutions to support the migration process. In this paper, we propose TestMigrationsInPy, a dataset of test migrations from unittest to pytest. TestMigrationsInPy contains 923 real-world migrations performed by developers. Future research proposing novel solutions to migrate frameworks in Python can rely on TestMigrationsInPy as a ground truth. Moreover, as TestMigrationsInPy includes information about the migration type (e.g., changes in assertions or fixtures), our dataset enables novel solutions to be verified effectively, for instance, from simpler assertion migrations to more complex fixture migrations. TestMigrationsInPy is publicly available at: https://github.com/altinoalvesjunior/TestMigrationsInPy.
翻译:Unittest和pytest是Python中最流行的测试框架。总体而言,pytest具有一些优势,包括更简洁的断言、夹具的重用以及互操作性。由于这些优点,Python生态系统中的多个项目已从unittest迁移到pytest。为促进迁移,pytest也能运行unittest测试,因此迁移可以随时间逐步进行。然而,迁移过程可能耗时且需要很长时间才能完成。在此背景下,项目将受益于支持迁移过程的自动化解决方案。本文提出了TestMigrationsInPy,一个从unittest到pytest的测试迁移数据集。TestMigrationsInPy包含了923个由开发者执行的真实迁移案例。未来研究若提出迁移Python框架的新颖解决方案,可以依赖TestMigrationsInPy作为基准事实。此外,由于TestMigrationsInPy包含了迁移类型的信息(例如断言或夹具的变更),我们的数据集使得新颖解决方案能够被有效验证,例如从较简单的断言迁移到更复杂的夹具迁移。TestMigrationsInPy公开可用,地址为:https://github.com/altinoalvesjunior/TestMigrationsInPy。