File: test_gha.py

package info (click to toggle)
python-ci-info 0.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 232 kB
  • sloc: python: 1,708; makefile: 3
file content (18 lines) | stat: -rw-r--r-- 477 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""Test should only pass in Github Actions environment"""
import os
import ci_info

def test_circle():
    IS_REAL_PR = bool(
        os.getenv("GITHUB_EVENT_NAME") and
        os.getenv("GITHUB_EVENT_NAME") == "pull_request"
    )
    assert ci_info.name() == "GitHub Actions"
    assert ci_info.is_ci() is True
    assert ci_info.is_pr() == IS_REAL_PR

    assert ci_info.info() == {
        "name": "GitHub Actions",
        "is_ci": True,
        "is_pr": IS_REAL_PR
    }