This project has moved and is read-only. For the latest updates, please go here.

running python tests in visual studio with x64 architecture

Apr 30, 2014 at 8:24 PM
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) ==========
Apr 30, 2014 at 8:37 PM
Most of what doesn't work with unit tests are some overlooked incompatibility :) Languages other than C# unfortunately weren't high on the agenda when the VS integration was being designed. We're working with them to make it more extensible for other languages, but they only get updates out occasionally, so it may not be "good" until the next major VS version.

That said, I think the problem in this case is that we explicitly state our architecture is x86, since we don't have a better way to guess. We may be able to specify AnyCPU or Default here instead, but I haven't had a chance to try it. I've posted the info on the issue, since that is where people are more likely to see it.
Marked as answer by brucegk on 4/30/2014 at 5:43 PM
Apr 1, 2015 at 3:56 PM
Is there any news/workaround for this issue, apart from changing the architecture in the test explorer settings to x86?

All C# projects in our mixed IP/C# solution are configured for x64, so it's a pain to keep having to change the test explorer settings to run the python tests independently.
Apr 1, 2015 at 4:46 PM
I tried making the change I mentioned above a while ago and it was more complicated than we had time to deal with. I'll take another look for 2.2, but can't promise anything. If I recall correctly, we have dependencies on 32-bit Visual Studio assemblies that we'd need to replace before this will work.