#2 conditionally skip some tests using 3.7 only features
Closed 3 years ago by churchyard. Opened 3 years ago by duck.
rpms/ duck/python-curio el8_port  into  rawhide

file modified
+7 -1
@@ -25,11 +25,13 @@ 

  

  Name:           python-%{pkgname}

  Version:        1.4

- Release:        1%{?dist}

+ Release:        2%{?dist}

  Summary:        Building blocks for performing concurrent I/O

  License:        BSD

  URL:            https://github.com/dabeaz/curio

  Source0:        %pypi_source

+ Patch0:         tests_skip_asyncio.run,patch

+ Patch1:         tests_skip_contextvars,patch

  BuildArch:      noarch

  

  
@@ -76,6 +78,10 @@ 

  

  

  %changelog

+ * Tue Oct 27 2020 Marc Dequènes (Duck) <duck@redhat.com> - 1.4-2

+ - conditionally skip some tests using asyncio.run which is a new provisional feature in 3.7

+ - conditionally skip test using contextvars only available on 3.7

+ 

  * Mon Oct 05 2020 Yatin Karel <ykarel@redhat.com> - 1.4-1

  - Update to 1.4

  

@@ -0,0 +1,65 @@ 

+ diff --git a/tests/test_queue.py b/tests/test_queue.py

+ index 739d361..2f92f50 100644

+ --- a/tests/test_queue.py

+ +++ b/tests/test_queue.py

+ @@ -6,6 +6,8 @@ import time

+  import threading

+  import asyncio

+  from curio.traps import _read_wait

+ +import pytest

+ +import sys

+  

+  def test_queue_simple(kernel):

+      results = []

+ @@ -523,6 +525,7 @@ def test_uqueue_asyncio_prod(kernel):

+  

+      kernel.run(consumer())

+  

+ +@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires python 3.7 or higher for asyncio.run")

+  def test_uqueue_asyncio_consumer(kernel):

+      results = []

+      async def consumer(queue):

+ diff --git a/tests/test_sync.py b/tests/test_sync.py

+ index b1316fb..7d4f5db 100644

+ --- a/tests/test_sync.py

+ +++ b/tests/test_sync.py

+ @@ -5,6 +5,7 @@

+  from collections import deque

+  from curio import *

+  import pytest

+ +import sys

+  import threading

+  import time

+  import asyncio

+ @@ -768,6 +769,7 @@ class TestUniversalEvent:

+              False

+          ]

+  

+ +    @pytest.mark.skipif(sys.version_info < (3, 7), reason="requires python 3.7 or higher for asyncio.run")

+      def test_uevent_get_asyncio_set(self, kernel):

+          results = []

+          async def event_setter(evt, seconds):

+ @@ -806,6 +808,7 @@ class TestUniversalEvent:

+          ]

+  

+  

+ +    @pytest.mark.skipif(sys.version_info < (3, 7), reason="requires python 3.7 or higher for asyncio.run")

+      def test_uevent_get_asyncio_wait(self, kernel):

+          results = []

+          async def event_setter(evt, seconds):

+ @@ -873,6 +876,7 @@ class TestResult:

+  

+          

+  class TestUniversalResult:

+ +    @pytest.mark.skipif(sys.version_info < (3, 7), reason="requires python 3.7 or higher for asyncio.run")

+      def test_universal_value(self, kernel):

+          

+          def work(x, y, r):

+ @@ -890,6 +894,7 @@ class TestUniversalResult:

+          kernel.run(main, r2, r3)

+          assert r3.unwrap() == 5

+  

+ +    @pytest.mark.skipif(sys.version_info < (3, 7), reason="requires python 3.7 or higher for asyncio.run")

+      def test_universal_error(self, kernel):

+          

+          def work(x, y, r):

@@ -0,0 +1,12 @@ 

+ diff --git a/tests/test_task.py b/tests/test_task.py

+ index 38a512a..b3eb15e 100644

+ --- a/tests/test_task.py

+ +++ b/tests/test_task.py

+ @@ -569,6 +569,7 @@ async def producer(ch):

+          await c.send(i)

+      await c.send(None)   # Sentinel

+  

+ +@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires python 3.7 or higher for contextvars")

+  def test_contextvars():

+      import contextvars

+      x = contextvars.ContextVar('x', default=0)

This is needed to port on EL8.

We need this package as a dependency for mailman3 packaging, so could you btw add EL8 build please?

The patches make sense, but please update the filenames to end with .patch instead of ,patch. I'll go ahead and request the epel8 branch so it's ready once this is merged. Thanks!

Just a note: from my experience, it might be better for the future maintenance to skip those tests in specfile rather than creating a patch because a patch might not work for the future version but a simple skip works as long as the tests have the same names.

@duck Are you interested in adjusting this PR?

If you are, please reopen.

Pull-Request has been closed by churchyard

3 years ago