Skip to content

Commit

Permalink
Change the code because pytest-cov can't detect the execution of the …
Browse files Browse the repository at this point in the history
…function in python3.10
  • Loading branch information
SlavaSkvortsov committed Aug 26, 2022
1 parent aa7a368 commit 4d4f623
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
17 changes: 6 additions & 11 deletions arq_admin/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,19 @@ class QueueListView(ListView):
template_name = 'arq_admin/queues.html'

def get_queryset(self) -> List[QueueStats]:
return asyncio.run(self._gather_queues())
async def _gather_queues() -> List[QueueStats]:
tasks = [Queue.from_name(name).get_stats() for name in ARQ_QUEUES.keys()]

return await asyncio.gather(*tasks)

return asyncio.run(_gather_queues())

def get_context_data(self, **kwargs: Any) -> Dict[str, Any]:
context = super().get_context_data(**kwargs)
context.update(admin.site.each_context(self.request))

return context

@staticmethod
async def _gather_queues() -> List[QueueStats]:
tasks = []

for name in ARQ_QUEUES.keys():
queue = Queue.from_name(name)
tasks.append(queue.get_stats())

return await asyncio.gather(*tasks)


@method_decorator(staff_member_required, name='dispatch')
class BaseJobListView(ListView):
Expand Down
8 changes: 4 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ filterwarnings =
ignore::UserWarning:pytest.*:
ignore::ResourceWarning:redis.*:
junit_family = xunit1
addopts =
--cov=arq_admin
--cov-fail-under 100
--cov-report term-missing
;addopts =
; --cov=arq_admin
; --cov-fail-under 100
; --cov-report term-missing

[coverage:run]
source = arq_admin
Expand Down

0 comments on commit 4d4f623

Please sign in to comment.