This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients serhiy.storchaka, vstinner
Date 2016-03-26.08:59:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> I replaced get_sys_path()/restore_sys_path() (2 methods) with ModuleAttr.get()+ModuleAttrList.encode_value() / ModuleAttr.restore()+ModuleAttrList.restore_attr() (4 methods).

I need to examine all other methods scattered around just to conclude that they are overloaded and aren't used indirectly.

Imagine that you are reading the code first time and need to know only about one resource. Three lines in two methods are much simpler then hundreds lines scattered in tens of methods.

> I'm not sure that it's a good thing to have dependencies between "resources". I see that Files depends on Cwd, but maybe the Files check can be integrated into Cwd?

I'm not sure that there are only two depended resources. In any case deterministic behavior is better. It is very unhappy to to research random test failures.

> Ok so the order matters, in this case, I can use a metaclass to use the order of class definition. It will make get_resources() simpler, it will be build directly in the metaclass.

No-no-no. Please don't complicate the code just because you can. This will make reading and modifying the code yet harder.

> How do you want to implement that? Currently, a resource has a "get" method which returns a blackbox. It's not easy to display it. There is not standard format.

There is a number of ways.

1. Just write smart general diff reporter as in unittest. It's Python, use force^W data reflection!

2. Add third method for resources that need special diff reporting. Use simple general diff reporter by default.

3. Split the "sys.path" resource on two simple resources: one test that sys.path identity is not changed, other tests it's content.
Date User Action Args
2016-03-26 08:59:27serhiy.storchakasetrecipients: + serhiy.storchaka, vstinner
2016-03-26 08:59:27serhiy.storchakasetmessageid: <>
2016-03-26 08:59:27serhiy.storchakalinkissue26643 messages
2016-03-26 08:59:25serhiy.storchakacreate