Skip to content

Commit

Permalink
Merge pull request #961 from sanger/develop
Browse files Browse the repository at this point in the history
Prepare release 2.36.0
  • Loading branch information
sdjmchattie authored Jul 23, 2024
2 parents 5861023 + 549e6c8 commit d5739a1
Show file tree
Hide file tree
Showing 12 changed files with 668 additions and 626 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/add_prs_to_tech_debt_project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Calls a reusable workflow in the .github repo,
# which adds the PR that triggered this to the Technical Debt project board, if it is a depfu one.
# Passes the 'PSD-AddToProject' GitHub App key and App Id as secrets to the reusable workflow.

name: Add dependencies to technical debt project

on:
# Triggered on creation of pull requests with any label,
# or when a label is added to an existing pull request.
pull_request:
types:
- labeled

jobs:
call-workflow-add_to_technical_debt_project:
uses: sanger/.github/.github/workflows/add_to_tech_debt_project_reusable.yml@master
secrets:
app_id: ${{ secrets.ADD_TO_PROJECT_APP_ID_PSD }}
app_key: ${{ secrets.ADD_TO_PROJECT_APP_KEY_PSD }}
12 changes: 12 additions & 0 deletions .github/workflows/assign_issue_number.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Assign Issue Number

on:
issues:
types: [opened]

jobs:
call-add-to-project:
uses: sanger/.github/.github/workflows/generate_issue_number.yml@master
secrets:
app_id: ${{ secrets.ISSUE_GEN_APP_ID }}
app_key: ${{ secrets.ISSUE_GEN_APP_KEY }}
3 changes: 1 addition & 2 deletions .github/workflows/automated_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,5 @@ jobs:
account-type: org
org-name: sanger
keep-at-least: 5
skip-tags: latest
skip-tags: latest, *[!develop] # This will DELETE any images where the tag contains ANY characters in "develop", excluding '!'
token: ${{ secrets.REMOVE_OLD_IMAGES }}

4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,6 @@ jobs:
run: |
python -m pytest -x
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .release-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.35.1
2.36.0
6 changes: 3 additions & 3 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ colorlog = "~=6.8"
eve = "~=2.1"
flask-apscheduler = "~=1.13"
flask-cors = "~=4.0"
gunicorn = "~=21.2"
gunicorn = "~=22.0"
openpyxl = "~=3.1"
pandas = "~=2.0"
pika = "~=1.3"
pymysql = "~=1.1"
pyodbc = "~=5.1"
python-dotenv = "~=1.0"
requests = "~=2.31"
requests = "~=2.32"
slackclient = "~=2.9"
sqlalchemy = "~=2.0"
pymongo = "~=4.6.2"
pymongo = "~=4.8.0"

[requires]
python_version = "3.8"
Expand Down
1,225 changes: 614 additions & 611 deletions Pipfile.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dependencies/down.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

cd "$(dirname "$0")"
docker-compose down
docker compose down
2 changes: 1 addition & 1 deletion dependencies/up.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

cd "$(dirname "$0")"
docker-compose up -d
docker compose up -d

# Initialise the MongoDB replica set after 5 seconds
sleep 5
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3.8"
services:
lighthouse:
build: .
Expand Down
7 changes: 5 additions & 2 deletions lighthouse/helpers/plates.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,11 @@ def convert_json_response_into_dict(barcode: str, json) -> dict:

def get_from_ss_plates_samples_info(plate_barcode: str) -> requests.Response:
ss_url: str = f"{app.config['SS_URL']}/api/v2/labware"
headers = _ss_headers()

try:
params = {"filter[barcode]": plate_barcode, "include": "purpose,receptacles.aliquots.sample"}
response = requests.get(f"{ss_url}", params=params)
response = requests.get(f"{ss_url}", params=params, headers=headers)

LOGGER.debug(f"Response status code: {response.status_code}")

Expand Down Expand Up @@ -814,7 +815,9 @@ def plate_exists_in_ss_with_barcode(barcode: str) -> bool:
params = {
"filter[barcode]": barcode,
}
response = requests.get(f"{ss_url}/api/v2/labware", params=params)
headers = _ss_headers()

response = requests.get(f"{ss_url}/api/v2/labware", params=params, headers=headers)

LOGGER.debug(f"Response status code: {response.status_code}")

Expand Down
11 changes: 8 additions & 3 deletions tests/helpers/test_plates_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@

# ---------- test helpers ----------

SS_AUTH_HEADER_MATCHER = responses.matchers.header_matcher({"X-Sequencescape-Client-Id": "development"})


@pytest.fixture
def mock_event_helpers():
Expand Down Expand Up @@ -143,7 +145,7 @@ def test_get_from_ss_plates_samples_info_success(app, mocked_responses):
)
json = {"data": ["plate data"], "included": ["plate includes"]}

mocked_responses.add(responses.GET, ss_url, json=json, status=HTTPStatus.OK)
mocked_responses.add(responses.GET, ss_url, json=json, status=HTTPStatus.OK, match=[SS_AUTH_HEADER_MATCHER])

response = get_from_ss_plates_samples_info(barcode)
assert response.json() == json
Expand All @@ -163,7 +165,7 @@ def test_convert_json_response_into_dict():
assert data == {"data": {"barcode": barcode, "positive_control": "A1", "negative_control": "B1"}, "error": None}


def test_classify_samples_by_centre(app, samples, mocked_responses):
def test_classify_samples_by_centre(samples):
samples, _ = samples
assert list(classify_samples_by_centre(samples).keys()) == ["centre_1", "centre_2"]
assert len(classify_samples_by_centre(samples)["centre_1"]) == 11
Expand All @@ -177,7 +179,7 @@ def test_centre_prefixes_for_samples(samples):
assert actual == ["centre_1", "centre_2"]


def test_centre_prefix(app, centres, mocked_responses):
def test_centre_prefix(app, centres):
with app.app_context():
assert get_centre_prefix("CENTRE_1") == "TC1"
assert get_centre_prefix("centre_2") == "TC2"
Expand Down Expand Up @@ -1057,6 +1059,7 @@ def test_format_plate_destination(app, mocked_responses):
f"{ss_url}?{urllib.parse.quote('filter[barcode]')}={plate_barcode}",
json={"data": ["barcode exists!"]},
status=HTTPStatus.OK,
match=[SS_AUTH_HEADER_MATCHER],
)
response = {
"plate_barcode": "dest_123",
Expand Down Expand Up @@ -1095,12 +1098,14 @@ def test_plate_exists_in_ss_with_barcode(app, mocked_responses):
f"{ss_url}?{urllib.parse.quote('filter[barcode]')}={first_plate_barcode}",
json={"data": ["barcode exists!"]},
status=HTTPStatus.OK,
match=[SS_AUTH_HEADER_MATCHER],
)
mocked_responses.add(
responses.GET,
f"{ss_url}?{urllib.parse.quote('filter[barcode]')}={second_plate_barcode}",
json={"data": []},
status=HTTPStatus.OK,
match=[SS_AUTH_HEADER_MATCHER],
)

assert plate_exists_in_ss_with_barcode(barcode=first_plate_barcode) is True
Expand Down

0 comments on commit d5739a1

Please sign in to comment.