Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from setuptools import setup, find_packages
from src.buildkite_test_collector.collector import constants

with open("README.md", "r") as fh:
long_description = fh.read()

setup(name='buildkite-test-collector',
version='0.1.4',
setup(name=constants.COLLECTOR_NAME,
version=constants.VERSION,
description='Buildkite Test Analytics collector',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down
6 changes: 6 additions & 0 deletions src/buildkite_test_collector/collector/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# constants.py

"""This module defines collector-level constants."""

COLLECTOR_NAME='buildkite-test-collector'
VERSION='0.1.4'
6 changes: 4 additions & 2 deletions src/buildkite_test_collector/collector/run_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from dataclasses import dataclass
from typing import Dict, Optional
from uuid import uuid4

import os
from .constants import COLLECTOR_NAME, VERSION # pylint: disable=W0611
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python linter doesn't recognise that imports that are interpolated are actually used, so disabling for this line
https://pylint.pycqa.org/en/latest/user_guide/messages/warning/unused-import.html


# pylint: disable=C0103 disable=R0902

Expand Down Expand Up @@ -115,7 +115,9 @@ def as_json(self) -> Dict[str, str]:
"branch": self.branch,
"commit_sha": self.commit_sha,
"message": self.message,
"url": self.url
"url": self.url,
"collector": 'python-{COLLECTOR_NAME}',
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I should be changing gem/package/library name in the setup.py, so I have instead added collector type clarity here by interpolating the language before the generic name (buildkite-test-collector is the same as the exlir and ruby collector names. The JS collector follows this pattern of interpolation the package name with the language).

"version": VERSION
}

return {k: v for k, v in attrs.items() if v is not None}
Expand Down
6 changes: 3 additions & 3 deletions tests/buildkite_test_collector/collector/test_run_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import mock

from buildkite_test_collector.collector.constants import COLLECTOR_NAME, VERSION # pylint: disable=W0611
from buildkite_test_collector.collector.run_env import detect_env


Expand Down Expand Up @@ -67,7 +68,6 @@ def test_detect_env_with_github_actions_env_vars_returns_the_correct_environment
assert runtime_env.job_id is None
assert runtime_env.message is None


def test_detect_env_with_circle_ci_env_vars_returns_the_correct_environment():
build_num = str(randint(0, 1000))
workflow_id = str(uuid4())
Expand All @@ -93,7 +93,6 @@ def test_detect_env_with_circle_ci_env_vars_returns_the_correct_environment():
assert runtime_env.job_id is None
assert runtime_env.message is None


def test_detect_env_with_generic_env_vars():
env = {
"CI": "true"
Expand All @@ -111,7 +110,6 @@ def test_detect_env_with_generic_env_vars():
assert runtime_env.job_id is None
assert runtime_env.message is None


def test_env_as_json(fake_env):
json = fake_env.as_json()

Expand All @@ -123,3 +121,5 @@ def test_env_as_json(fake_env):
assert json["commit_sha"] == fake_env.commit_sha
assert json["message"] == fake_env.message
assert json["url"] == fake_env.url
assert json["collector"] == 'python-{COLLECTOR_NAME}'
assert json["version"] == VERSION