<div dir="ltr">Thanks! I'll try the nose-users list - didn't know of it.<div>Tried to run with '-i tests' BTW, didn't do the trick.<br><div><br><div class="gmail_quote">On Tue, Feb 15, 2011 at 11:10 AM, holger krekel <span dir="ltr"><<a href="mailto:holger@merlinux.eu">holger@merlinux.eu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Tue, Feb 15, 2011 at 10:22 +0200, Yoni Tsafir wrote:<br>
> > Yoni,<br>
> ><br>
> > could you maybe give some precise example directory layout instead<br>
> > of describing it in words?<br>
> ><br>
><br>
> Well, its something like this:<br>
> myproject/<br>
> - contains non platform-specific code (in root and in other subdirectories)<br>
> myproject/platform/<platform_name>/**<br>
> - contains platform specific code for each platform<br>
<br>
</div>And your tests are in myprojects/test*/ and myproject/platform/platform_name/test*/<br>
directories?<br>
<br>
If so, i am sure you can solve it with nose but someone else needs to tell you<br>
how. I could only tell you a solution for py.test.<br>
<br>
You might want to mail nose-users via<br>
<a href="http://groups.google.com/group/nose-users?hl=en" target="_blank">http://groups.google.com/group/nose-users?hl=en</a><br>
<br>
hth,<br>
<font color="#888888">holger<br>
</font><div><div></div><div class="h5"><br>
> ><br>
> > Besides, it's always good to avoid code in __init__.py<br>
> > files including imports.<br>
> ><br>
> ><br>
> I agree with this in general. This might just be what I'll have to do for<br>
> our code...<br>
> Won't be very easy though... :)<br>
><br>
><br>
> > best,<br>
> > holger<br>
> ><br>
> > On Mon, Feb 14, 2011 at 19:14 +0200, Yoni Tsafir wrote:<br>
> > > OK,<br>
> > > So I know a few weeks ago there was a multiplatform related question, but<br>
> > > mine is a bit different.<br>
> > ><br>
> > > I'm working on a project that has platform specific code in its working<br>
> > > tree.<br>
> > > No matter what are the reasons, but currently in the same project tree<br>
> > there<br>
> > > is platform specific code for several platforms side by side, and it<br>
> > > currently can't be separated to different trees.<br>
> > ><br>
> > > Now, about the unit-tests: pretty simple, each unit-test that can run<br>
> > only<br>
> > > on a specific platform, raises a SkipTest in case you try running it on a<br>
> > > different one (similar to what was suggested here a few weeks back).<br>
> > > Also, notice that some unit-tests may be in a platform specific package,<br>
> > but<br>
> > > can actually run on all packages (because of mocks).<br>
> > ><br>
> > > Great.<br>
> > ><br>
> > > Now,<br>
> > > I want to be able to run all tests in my project with nose by running<br>
> > > nosetests recursively on the root directory.<br>
> > > What's the problem with that?<br>
> > ><br>
> > > The problem is that some of my __init__.py of the windows specific code,<br>
> > > imports win32api, which exists only in windows.<br>
> > > Now from what I could understand, when nose is given a directory rather<br>
> > than<br>
> > > a list of tests, it tries finding tests in all the packages recursively,<br>
> > and<br>
> > > in the process it actually imports all __init__.py of modules, including<br>
> > the<br>
> > > ones that are trying to import other platform specific stuff.<br>
> > ><br>
> > > This is a problem, because there are no tests to skip here, and I end up<br>
> > > getting an Error in my test-suite that isn't actually connected to a<br>
> > test.<br>
> > ><br>
> > > Now, the way I see handling this right now, is avoiding importing stuff<br>
> > in<br>
> > > __init__.py of packages, and either insert it into the function<br>
> > definitions,<br>
> > > or to other .py files that are imported only explicitly and not from<br>
> > other<br>
> > > __init__.py<br>
> > > I must say I'm not really crazy about this solution.<br>
> > ><br>
> > > Other solutions I thought of is to separate my code to different working<br>
> > > trees and run on them (which is a big problem currently),<br>
> > > Or using something like --exclude=windows in nose, but this is bad<br>
> > because<br>
> > > under windows there are unit tests that can be ran on any platform<br>
> > (because<br>
> > > of mocks).<br>
> > ><br>
> > > I was wondering if any of you can think of a better way to solve this<br>
> > > annoying problem.<br>
> > ><br>
> > > Thanks!<br>
> > > Yoni.<br>
> ><br>
> > > _______________________________________________<br>
> > > testing-in-python mailing list<br>
> > > <a href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.org</a><br>
> > > <a href="http://lists.idyll.org/listinfo/testing-in-python" target="_blank">http://lists.idyll.org/listinfo/testing-in-python</a><br>
> ><br>
> ><br>
> > --<br>
> ><br>
<br>
</div></div>--<br>
</blockquote></div><br></div></div></div>