|
56 | 56 | # noinspection PyProtectedMember |
57 | 57 | from reportportal_client._internal.static.abstract import AbstractBaseClass, abstractmethod |
58 | 58 | from reportportal_client._internal.static.defines import DEFAULT_LOG_LEVEL |
| 59 | +from reportportal_client.aio import EmptyTask |
59 | 60 |
|
60 | 61 | # noinspection PyProtectedMember |
61 | 62 | from reportportal_client.aio.tasks import Task |
@@ -1311,7 +1312,7 @@ def __init__( |
1311 | 1312 | set_current(self) |
1312 | 1313 |
|
1313 | 1314 | @abstractmethod |
1314 | | - def create_task(self, coro: Coroutine[Any, Any, _T]) -> Optional[Task[_T]]: |
| 1315 | + def create_task(self, coro: Coroutine[Any, Any, _T]) -> Task[_T]: |
1315 | 1316 | """Create a Task from given Coroutine. |
1316 | 1317 |
|
1317 | 1318 | :param coro: Coroutine which will be used for the Task creation. |
@@ -1572,7 +1573,7 @@ def get_launch_ui_url(self) -> Task[Optional[str]]: |
1572 | 1573 | result_task = self.create_task(result_coro) |
1573 | 1574 | return result_task |
1574 | 1575 |
|
1575 | | - def get_project_settings(self) -> Task[Optional[str]]: |
| 1576 | + def get_project_settings(self) -> Task[Optional[dict]]: |
1576 | 1577 | """Get settings of the current Project. |
1577 | 1578 |
|
1578 | 1579 | :return: Settings response in Dictionary. |
@@ -1685,8 +1686,9 @@ def __init_loop(self, loop: Optional[asyncio.AbstractEventLoop] = None): |
1685 | 1686 | self._loop = asyncio.new_event_loop() |
1686 | 1687 | self._loop.set_task_factory(ThreadedTaskFactory(self.task_timeout)) |
1687 | 1688 | self.__heartbeat() |
1688 | | - self._thread = threading.Thread(target=self._loop.run_forever, name="RP-Async-Client", daemon=True) |
1689 | | - self._thread.start() |
| 1689 | + thread = threading.Thread(target=self._loop.run_forever, name="RP-Async-Client", daemon=True) |
| 1690 | + thread.start() |
| 1691 | + self._thread = thread |
1690 | 1692 |
|
1691 | 1693 | async def __return_value(self, value): |
1692 | 1694 | return value |
@@ -1758,14 +1760,14 @@ def __init__( |
1758 | 1760 | else: |
1759 | 1761 | super().__init__(endpoint, project, launch_uuid=launch_uuid, **kwargs) |
1760 | 1762 |
|
1761 | | - def create_task(self, coro: Coroutine[Any, Any, _T]) -> Optional[Task[_T]]: |
| 1763 | + def create_task(self, coro: Coroutine[Any, Any, _T]) -> Task[_T]: |
1762 | 1764 | """Create a Task from given Coroutine. |
1763 | 1765 |
|
1764 | 1766 | :param coro: Coroutine which will be used for the Task creation. |
1765 | 1767 | :return: Task instance. |
1766 | 1768 | """ |
1767 | 1769 | if not getattr(self, "_loop", None): |
1768 | | - return None |
| 1770 | + return EmptyTask() |
1769 | 1771 | result = self._loop.create_task(coro) |
1770 | 1772 | with self._task_mutex: |
1771 | 1773 | self._task_list.append(result) |
@@ -1951,14 +1953,14 @@ def __init__( |
1951 | 1953 | else: |
1952 | 1954 | super().__init__(endpoint, project, launch_uuid=launch_uuid, **kwargs) |
1953 | 1955 |
|
1954 | | - def create_task(self, coro: Coroutine[Any, Any, _T]) -> Optional[Task[_T]]: |
| 1956 | + def create_task(self, coro: Coroutine[Any, Any, _T]) -> Task[_T]: |
1955 | 1957 | """Create a Task from given Coroutine. |
1956 | 1958 |
|
1957 | 1959 | :param coro: Coroutine which will be used for the Task creation. |
1958 | 1960 | :return: Task instance. |
1959 | 1961 | """ |
1960 | 1962 | if not getattr(self, "_loop", None): |
1961 | | - return None |
| 1963 | + return EmptyTask() |
1962 | 1964 | result = self._loop.create_task(coro) |
1963 | 1965 | with self._task_mutex: |
1964 | 1966 | tasks = self._task_list.append(result) |
|
0 commit comments