-
Notifications
You must be signed in to change notification settings - Fork 749
Fixes breaking tests in .Net Core 2.0 #605
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
Conversation
@dmitriyse @denfromufa |
Codecov Report
@@ Coverage Diff @@
## pytests-core #605 +/- ##
===============================================
- Coverage 70.85% 70.66% -0.2%
===============================================
Files 64 64
Lines 5607 5607
Branches 887 887
===============================================
- Hits 3973 3962 -11
- Misses 1343 1352 +9
- Partials 291 293 +2
Continue to review full report at Codecov.
|
@Cronan just tested this PR on Windows and getting 6 failures: Click here to expand the pytest resultsC:\Python\pythonnet\pythonnet>dotnet build\lib.win-amd64-3.5\netcoreapp2.0\nPython.dll
Python 3.5.3 (v3.5.3:1880cb95a742, Jan 16 2017, 16:02:32) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import clr
>>> import sys
>>> sys.path.append(r"C:\Python\pythonnet\pythonnet\build\lib.win-amd64-3.5\netcoreapp2.0")
>>> import pytest
>>> pytest.main()
============================= test session starts =============================
platform win32 -- Python 3.5.3, pytest-3.1.3, py-1.4.34, pluggy-0.4.0
rootdir: C:\Python\pythonnet\pythonnet, inifile: setup.cfg
collected 293 items
src\tests\test_array.py ........................................
src\tests\test_callback.py ..
src\tests\test_class.py ..................
src\tests\test_clrmethod.py FFFFF
src\tests\test_compat.py ................
src\tests\test_constructors.py ....
src\tests\test_conversion.py ....................
src\tests\test_docstring.py ...
src\tests\test_engine.py .ss
src\tests\test_enum.py ...............
src\tests\test_exceptions.py .........................
src\tests\test_field.py ..............................
src\tests\test_generic.py .................
src\tests\test_import.py .
src\tests\test_indexer.py .............................
src\tests\test_interface.py ....
src\tests\test_method.py ..............................................
src\tests\test_property.py ..........
src\tests\test_recursive_types.py .
src\tests\test_sysargv.py F
src\tests\test_thread.py ...
=========================== short test summary info ===========================
FAIL src/tests/test_clrmethod.py::test_set_and_get_property_from_py
FAIL src/tests/test_clrmethod.py::test_set_and_get_property_from_clr
FAIL src/tests/test_clrmethod.py::test_set_and_get_property_from_clr_and_py
FAIL src/tests/test_clrmethod.py::test_method_invocation_from_py
FAIL src/tests/test_clrmethod.py::test_method_invocation_from_clr
FAIL src/tests/test_sysargv.py::test_sys_argv_state
SKIP [1] src\tests\test_engine.py:29: FIXME: test freezes
SKIP [1] src\tests\test_engine.py:21: FIXME: test crashes
========================== slowest 5 test durations ===========================
1.11s call src/tests/test_thread.py::test_python_thread_calls_to_clr
0.29s call src/tests/test_compat.py::test_multiple_imports
0.20s call src/tests/test_sysargv.py::test_sys_argv_state
0.18s call src/tests/test_callback.py::test_default_for_null
0.12s call src/tests/test_exceptions.py::test_str_of_exception
================================== FAILURES ===================================
______________________ test_set_and_get_property_from_py ______________________
def test_set_and_get_property_from_py():
"""Test setting and getting clr-accessible properties from python."""
> t = ExampleClrClass()
E TypeError: no constructor matches given arguments
src\tests\test_clrmethod.py:30: TypeError
_____________________ test_set_and_get_property_from_clr ______________________
def test_set_and_get_property_from_clr():
"""Test setting and getting clr-accessible properties from the clr."""
> t = ExampleClrClass()
E TypeError: no constructor matches given arguments
src\tests\test_clrmethod.py:39: TypeError
__________________ test_set_and_get_property_from_clr_and_py __________________
def test_set_and_get_property_from_clr_and_py():
"""Test setting and getting clr-accessible properties alternatingly from the clr and from python."""
> t = ExampleClrClass()
E TypeError: no constructor matches given arguments
src\tests\test_clrmethod.py:49: TypeError
_______________________ test_method_invocation_from_py ________________________
def test_method_invocation_from_py():
"""Test calling a clr-accessible method from python."""
> t = ExampleClrClass()
E TypeError: no constructor matches given arguments
src\tests\test_clrmethod.py:67: TypeError
_______________________ test_method_invocation_from_clr _______________________
def test_method_invocation_from_clr():
"""Test calling a clr-accessible method from the clr."""
> t = ExampleClrClass()
E TypeError: no constructor matches given arguments
src\tests\test_clrmethod.py:72: TypeError
_____________________________ test_sys_argv_state _____________________________
filepath = <function filepath.<locals>.make_filepath at 0x00000230BAD92158>
def test_sys_argv_state(filepath):
"""Test sys.argv state doesn't change after clr import.
To better control the arguments being passed, test on a fresh python
instance with specific arguments"""
script = filepath("argv-fixture.py")
> out = check_output([sys.executable, script, "foo", "bar"])
src\tests\test_sysargv.py:16:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src\tests\_compat.py:71: in check_output
output = subprocess.check_output(*args, **kwargs)
..\..\Python35_64b\Lib\subprocess.py:316: in check_output
**kwargs).stdout
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
input = None, timeout = None, check = True
popenargs = (['C:\\Program Files\\dotnet\\dotnet.exe', 'C:\\Python\\pythonnet\\pythonnet\\src\\tests\\fixtures/netstandard2.0\\argv-fixture.py', 'foo', 'bar'],)
kwargs = {'stdout': -1}
process = <subprocess.Popen object at 0x00000230BAFC46A0>, stdout = b''
stderr = None, retcode = 1
def run(*popenargs, input=None, timeout=None, check=False, **kwargs):
"""Run command with arguments and return a CompletedProcess instance.
The returned instance will have attributes args, returncode, stdout and
stderr. By default, stdout and stderr are not captured, and those attributes
will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them.
If check is True and the exit code was non-zero, it raises a
CalledProcessError. The CalledProcessError object will have the return code
in the returncode attribute, and output & stderr attributes if those streams
were captured.
If timeout is given, and the process takes too long, a TimeoutExpired
exception will be raised.
There is an optional argument "input", allowing you to
pass a string to the subprocess's stdin. If you use this argument
you may not also use the Popen constructor's "stdin" argument, as
it will be used internally.
The other arguments are the same as for the Popen constructor.
If universal_newlines=True is passed, the "input" argument must be a
string and stdout/stderr in the returned object will be strings rather than
bytes.
"""
if input is not None:
if 'stdin' in kwargs:
raise ValueError('stdin and input arguments may not both be used.')
kwargs['stdin'] = PIPE
with Popen(*popenargs, **kwargs) as process:
try:
stdout, stderr = process.communicate(input, timeout=timeout)
except TimeoutExpired:
process.kill()
stdout, stderr = process.communicate()
raise TimeoutExpired(process.args, timeout, output=stdout,
stderr=stderr)
except:
process.kill()
process.wait()
raise
retcode = process.poll()
if check and retcode:
raise CalledProcessError(retcode, process.args,
> output=stdout, stderr=stderr)
E subprocess.CalledProcessError: Command '['C:\\Program Files\\dotnet\\dotnet.exe', 'C:\\Python\\pythonnet\\pythonnet\\src\\tests\\fixtures/netstandard2.0\\argv-fixture.py', 'foo', 'bar']' returned non-zero exit status 1
..\..\Python35_64b\Lib\subprocess.py:398: CalledProcessError
---------------------------- Captured stderr call -----------------------------
No executable found matching command "dotnet-C:\Python\pythonnet\pythonnet\src\tests\fixtures/netstandard2.0\argv-fixture.py"
=============== 6 failed, 285 passed, 2 skipped in 7.18 seconds =============== |
@Cronan, IMHO, switching tests to the .net standard 2.0 classes is a good idea in general, but I want to found a way to link some extra nuget in py tests, to test engine assembly loading solution (that is not implemented yet for .net standard 2.0). For example System.Drawing.Primitives nuget, so some test need not to be modified. |
@dmitriyse i tried debugging these I suggest that we disable these subclassing tests when under .NET Core, until clr.pyd/clr.so is ready for .NET Core mode. |
I meant Console.15.csproj, not clrmodule.15.csproj above. |
@denfromufa I get these failures too, but then I got them before I made the other changes. |
@dmitriyse What about adding some tests into test_compat to cover engine assembly loading? |
@dmitriyse @denfromufa So should I close this if it's not acceptable? |
@Cronan this PR looks good to me, please skip the failing tests conditionally under .net core @dmitriyse are you ok with this PR? I'M OK with dropping System.Drawing, even if it is available via nuget |
System.Drawing can be excluded, but Non Generic collections should definetely works (even I am personally hate this legacy subsystem). |
@dmitriyse can you please be more specific about non-generic collections? I did find any issue. Do you mean you are not OK with switch from HashTable to ArrayList? |
Yes, exactly this change. We should work fine with all classes: That were moved out in the NetStandard 2.0 from core to nuget https://www.nuget.org/packages/System.Collections.NonGeneric |
@dmitriyse the point of this test is not testing all non-generic collections, but only testing test_basic_subclass, so I'm ok with ArrayList in this PR. So I'm approving this PR, we can add skipping failing tests later once .NET Core support is stabilized and in CI. |
Anymore for any more? @dmitriyse @filmor @vmuriart |
@Cronan can you submit this PR against the main branch? Why is this in pytests-core branch? |
I’m not sure, I thought I’d created it against main
… On 17 Feb 2018, at 04:30, Denis Akhiyarov ***@***.***> wrote:
@Cronan can you submit this PR against the main branch? Why is this in pytests-core branch?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Contributes to fixing the issues detailed in #590