This project has moved. For the latest updates, please go here.

running python unit tests with x64 platform set


The VS test runner as two options for the default platform x86 and x64. Python unit test projects will run when set to x86 but not x64, and there seems to be no way to set the platform for the python proj ('any cpu' being the only option - which for some reason is not accepted by x64). This is a problem since all the other projects in the solution are x64 projects, so the test platform needs to be changed and rerun to run all the tests. I don't think there is any reason for this problem other than some overlooked incompatibility.
This is the error indicated

------ Discover test started ------
Test run will use DLL(s) built for framework Framework45 and platform X64. Following DLL(s) will not be part of run:
TestPython.pyproj is built for Framework None and Platform X86.
Go to for more details on managing these settings.
Exception occurred while instantiating discoverer : Exception has been thrown by the target of an invocation.
========== Discover test finished: 2 found (0:01:29.2394666) ==========


Zooba wrote Apr 30, 2014 at 7:34 PM

This may be as simple as changing the architecture in our test containers to "Default" rather than "X86". (Requires rebuilding, so it isn't a workaround - but someone else may get to this before I do.)

theodox wrote May 7, 2014 at 6:07 AM

This may also account for an issue I have: I have a set of code and tests I use in Autodesk Maya. The built-in python intepreter ('mayapy.exe') runs fine as an alternative to a regular 2.7 install, and I can write, auto-complete and execute using it. However I cannot discover or run tests with the test explorer when MayaPy is the active environment.

One hypothesis is that MayaPy, being 64 bit, is not working for the reasons above. The other thing that might be going on is that maya ships the standard library in a zip file. When this is on the path the code runs correctly but Intellisense does not seem to see the completions for standard library items.

Either way, this would be nice to get working - lack of test coverage is preventing me from relying on PTVS as a primary tool.

Zooba wrote May 7, 2014 at 12:49 PM

If you can't discover tests at all, you have a different issue. It's almost certainly because of the zip file, and chances are there are only .pyc files in there, so even if we were looking inside the zip it probably wouldn't help. You can reconfigure the Library Path property (might need a newer PTVS if you don't have that field) to point at a normal Python install - it only gets used for completions.

Zooba wrote Jun 24, 2014 at 6:22 PM

I've tried changing the container architecture to Default, but then when the setting is set to X64 it will run the discoverer and executor in a 64-bit process. Since we currently need to load VS assemblies as part of discovery, this causes us to fail completely.

It looks like it will be a more significant rewrite than I expected to fix this, and I'm not yet sure what it will look like. This may not make it into 2.1, unfortunately.