• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tjcsl / tin / 17450891849

04 Sep 2025 01:49AM UTC coverage: 58.858% (+0.2%) from 58.654%
17450891849

Pull #92

github

web-flow
Merge 8c9f1d1d3 into 564991635
Pull Request #92: Allow choosing custom versions of python for graders

470 of 971 branches covered (48.4%)

Branch coverage included in aggregate %.

59 of 81 new or added lines in 12 files covered. (72.84%)

1 existing line in 1 file now uncovered.

1746 of 2794 relevant lines covered (62.49%)

0.62 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

38.89
/tin/apps/venvs/tasks.py
1
from __future__ import annotations
1✔
2

3
import logging
1✔
4
import subprocess
1✔
5

6
from celery import shared_task
1✔
7

8
from .models import Venv, VenvCreationError
1✔
9

10
logger = logging.getLogger(__name__)
1✔
11

12

13
@shared_task
1✔
14
def create_venv(venv_id):
1✔
15
    venv = Venv.objects.get(id=venv_id)
×
16

17
    success = False
×
18
    try:
×
NEW
19
        python = venv.language.info["python3"]
×
20
        try:
×
21
            res = subprocess.run(
×
22
                [
23
                    python,
24
                    "-m",
25
                    "venv",
26
                    "--",
27
                    venv.path,
28
                ],
29
                check=False,
30
                stdin=subprocess.DEVNULL,
31
                stdout=subprocess.PIPE,
32
                stderr=subprocess.STDOUT,
33
            )
34
        except FileNotFoundError as e:
×
35
            logger.error("Cannot run processes: %s", e)
×
36
            raise FileNotFoundError from e
×
37

38
        if res.returncode != 0:
×
39
            raise VenvCreationError(
×
40
                f"Error creating virtual environment (return code {res.returncode}): {res.stdout}"
41
            )
42

43
        venv.fully_created = True
×
44
        venv.save()
×
45
        success = True
×
46
    finally:
47
        if not success:
×
48
            venv.delete()
×
49

50

51
@shared_task
1✔
52
def install_packages(venv_id, package_names):
1✔
53
    venv = Venv.objects.get(id=venv_id)
×
54

55
    venv.install_packages(package_names)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc