-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
write tests #19
Comments
(moving idea from the closed issue to here) It would be really nice to be able to test the correct behaviour and values returned for all the supported platforms on any arbitrary system where Python is available (e.g.: test all platforms by running the tests on a RiscOS system) @mcepl: how difficult would it be to test the actual behaviour for all supported platforms on any arbitrary platform? |
I have completely misunderstood this question. Of course, you mean testing Windows behavior on Linux etc. (or in Travis-CI, which is Linux-only I believe). Then I guess we need to do some mocking. Which may be a challenge for older releases of python. (original answer)
See the post mentioned in the comment on #17 for an example of the Windows values. |
Yes, something like that. |
@mcepl: Did you have some time to think about my proposal? I am thinking that even if older version might not handle mocking or monkey patching correctly, appdirs itself could work correctly. What do you think? (I am really curious about some model of functional tests so I can write some for the XDG standard part, according to your example.) |
Let me think a bit aloud. The first concern is that we DO NOT want to test code outside of our project. Therefore, and to make our code as simple as possible and especially as platform-independent as possible. I would prefer using stdlib/win32 methods like os.path.expanduser (which should work on Windows or any platform Python runs) to get a home directory rather than weird speleology I see in _get_win_folder_from_registry (although, I am not sure what exactly this code does, not having Windows at hand, so maybe it is necessary). If in any way possible to replace _get_win_folder_from_registry or other heavily platform dependent functions, I would do it. Concerning mocking itself. Yes, we cannot avoid it, but I would keep it as little as possible. So, probably when testing behavior on Windows, we should just mock a standard function and then compare the results. Something like
Does it make sense? |
2013/3/22 Matěj Cepl notifications@github.com
Those functions, AIUI, try to adapt to various situations often present on I agree with simplification, but from what I can see, those if sys.platform == "win32":
If that info from the standard Python API grabs the correct info from @srid's input would be useful. |
I am sorry, but being who I am (an engineer at Red Hat), I have no clue about the Windows situation at all. But we would need somebody to investigate what exactly functions like |
I officially give up on resolving any questions for the platform I have no access to. Sorry. |
|
@mcepl: any idea on the cross testing with focus on Linux? I started something based on py.test in my private repo, but I don't know what should be the model for unittest test frame. |
@srid: Taking into account:
Wouldn't it be a good idea to release 1.3.0 now without the new tests which don't exist? For my project I am still using a Linux only appdirs-like small class that works for now, because I know for a fact the latest appdirs release is broken, and the adoption of appdirs in other projects targeting Linux will surely not happen while the broken 1.2.0 version is the advertised latest and greatest. |
+1 for the 1.3.0 release, but i'm going to defer this (need to first look into how it will affect our internal tools). |
@srid : Great. How much time do you expect it will take you to do the needed checks? |
@srid: any news regarding the release of 1.3.0? |
@srid: Any news? One month has passed since our last interaction, and I don't see any users benefiting from this delay. |
@srid: Are you still working on this code? Have you tested the impact it has on your tools? Could you please release 1.3.0 already? The code was ready for release 6 months ago, but it looks like your company is keeping the code hostage for unknown reasons. This is not how the open source community works. |
@eddyp - 1.3.0 has been released today, https://pypi.python.org/pypi/appdirs/1.3.0 ... next time, don't be so annoying. thanks for your contributions. |
test_api.py
only tests the type of the return values. we need tests to cover the behaviour of appdirs functions (i.e., return values) on each platform.The text was updated successfully, but these errors were encountered: