[英]How do I find out all previous versions of python with which my code is compatible
I have created a medium sized project in python 2.7.3 containing around 100 modules. 我在python 2.7.3中创建了一个中等大小的项目,其中包含大约100个模块。 I wish to find out with which previous versions of python (ex: 2.6.x, 2.7.x) is my code compatible (before releasing my project in public domain). 我希望找出与python的先前版本(例如:2.6.x,2.7.x)兼容的代码(在公共领域发布我的项目之前)。 What is the easiest way to find it out? 找出它的最简单方法是什么?
Solutions I know - 我知道的解决方案-
Kindly provide better solutions. 请提供更好的解决方案。
I don't really know of a way to get around doing this without some test cases. 我真的不知道没有一些测试用例就能解决这个问题的方法。 Even if your code could run in an older version of python there is no guarantee that it works correctly without a suite of test cases that sufficiently test your code 即使您的代码可以在旧版本的python中运行,也不能保证没有一组足以测试您的代码的测试用例,它就可以正确运行
No, what you named is pretty much how it's done, though the What's New pages and the documentation proper may be more useful than the full changelog. 不,虽然“新增功能”页面和适当的文档可能比完整的变更日志更有用,但您所命名的几乎是完成工作的方式。 Compatibility to such a huge, moving target is infeasible to automate even partially. 与如此巨大的移动目标的兼容性甚至无法部分自动化。 It's just not as much work as it sounds like, because: 它的工作量并不像听起来那样多,因为:
So, you could either limit yourself to 2.7 (it's been out for three years), or perform tests on older releases. 因此,您可以将自己限制为2.7(已经使用了三年),也可以在较旧的版本上进行测试。 If you just want to determine whether it's compatible, not which incompatibilities there are and how they can be fixed, you can: 如果您只想确定它是否兼容,而不是确定存在哪些不兼容以及如何解决这些不兼容,则可以:
1) If you're going to maintain compatibility with previous versions, testing is the way to go. 1)如果要保持与以前版本的兼容性,则必须进行测试。 Even if your code happens to be compatible now, it can stop being so at any moment in the future if you don't pay attention. 即使您的代码现在恰好兼容,但如果您不注意的话,将来任何时候都可能停止兼容。
2) If backwards compatibility is not an objective but just a "nice side-feature for those lucky enough", an easy way for OSS is to let users try it out, noting that "it was tested in <version>
but may work in previous ones as well". 2)如果向后兼容性不是目标,而仅仅是“足够幸运的人的附属功能”,那么OSS的一种简单方法就是让用户尝试一下,并指出“它已经在<version>
进行了测试,但可以在以前的”。 If there's anyone in your user base interested in running your code in an earlier version (and maintain compatibility with it), they'll probably give you feedback. 如果您的用户群中有任何人有兴趣在较早版本中运行您的代码(并保持与之的兼容性),他们可能会给您反馈。 If there isn't, why bother? 如果没有,何必呢?
A lot easier with some test cases but manual testing can give you a reasonably idea. 使用一些测试用例会容易得多,但是手动测试可以为您提供一个合理的想法。
Take the furthest back version that you would hope to support, (I would suggest 2.5.x but further back if you must - manually test with that version keeping notes of what you did and especially where it fails if any where - if it does fail then either address the issue or do a binary search to see which version the failure point(s) disappear at. This could work even better if you start from a version that you are quite sure you will fail at, 2.0 maybe. 取得您希望支持的最新版本((我建议使用2.5.x,但如果需要则建议更进一步)-手动测试该版本,并记下您所做的操作,尤其是在出现故障的地方-如果出现故障-如果发生故障然后解决该问题或进行二进制搜索以查看故障点消失在哪个版本上。如果您从肯定会失败的版本开始,则可能会更好,例如2.0。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.