Skip to content

Add automation scripts tests#586

Merged
khairahscorner merged 3 commits into
Women-Coding-Community:mainfrom
TechGenie-awake:add-automation-scripts-tests
Oct 7, 2025
Merged

Add automation scripts tests#586
khairahscorner merged 3 commits into
Women-Coding-Community:mainfrom
TechGenie-awake:add-automation-scripts-tests

Conversation

@TechGenie-awake

@TechGenie-awake TechGenie-awake commented Oct 6, 2025

Copy link
Copy Markdown
Contributor

Description

Added comprehensive test coverage for automation scripts in the tools folder:

  • automation_prepare_adhoc_availability.py – Tests for mentor availability logic, including sorting, XLSX → YAML updates, and handling of missing or empty data.
  • download_image.py – Tests for image download, filename sanitization, error handling, and automation script behavior.
  • meetup_import.py – Tests for event parsing, description cleaning, host/speaker extraction, image URL fetching, and YAML processing.

Change Type

  • Bug Fix
  • New Feature (tests added for existing scripts)
  • Code Refactor
  • Mentor Update
  • Data Update
  • Documentation
  • Other

Related Issue

resolves #579

Screenshots

Pull request checklist

Please check if your PR fulfills the following requirements:

  • I checked and followed the contributor guide
  • I have tested my changes locally.
  • I have added a screenshot from the website after I tested it locally

- Test name and description cleaning functions
- Test host and speaker extraction logic
- Test YAML string helpers (LiteralString, QuotedString, NoQuoteString)
- Test event key generation and existing event loading
- Test successful image download and file creation
- Test handling of network failures
- Test directory creation when path does not exist
- Test filename sanitization with special characters
- Test mentor sorting logic for available and unavailable mentors
- Test availability update dictionary creation from XLSX
- Test update_mentor_availability function end-to-end with XLSX and YAML
- Cover edge cases: empty hours, mentors not in XLSX, preserving existing data
@TechGenie-awake TechGenie-awake requested a review from a team as a code owner October 6, 2025 15:09
@dricazenck

dricazenck commented Oct 6, 2025

Copy link
Copy Markdown
Contributor

Based in the test execution, which you can see from github actions, it all passing :) great work 👍

Run pytest tools
============================= test session starts ==============================
platform linux -- Python 3.12.11, pytest-8.1.1, pluggy-1.6.0
rootdir: /home/runner/work/WomenCodingCommunity.github.io/WomenCodingCommunity.github.io
collected 45 items

tools/example_test.py .                                                  [  2%]
tools/tests/automation_functional_test.py .                              [  4%]
tools/tests/automation_prepare_adhoc_availability_test.py .............. [ 35%]
.                                                                        [ 37%]
tools/tests/download_image_test.py .......                               [ 53%]
tools/tests/file_utils_test.py ....                                      [ 62%]
tools/tests/meetup_import_test.py .............                          [ 91%]
tools/tests/mentorship_type_test.py ....                                 [100%]

=============================== warnings summary ===============================
tools/tests/automation_functional_test.py: 2 warnings
tools/tests/automation_prepare_adhoc_availability_test.py: 9 warnings
  /opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/openpyxl/packaging/core.py:99: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
    now = datetime.datetime.utcnow()

tools/tests/automation_prepare_adhoc_availability_test.py::TestUpdateMentorAvailability::test_updates_mentor_availability_from_xlsx
tools/tests/automation_prepare_adhoc_availability_test.py::TestUpdateMentorAvailability::test_mentor_not_in_xlsx_becomes_unavailable
tools/tests/automation_prepare_adhoc_availability_test.py::TestUpdateMentorAvailability::test_keeps_existing_hours_when_xlsx_hours_empty
  /opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/openpyxl/writer/excel.py:292: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
    workbook.properties.modified = datetime.datetime.utcnow()

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================= 45 passed, 14 warnings in 1.30s ========================

There some warnings and deprecations, but I think it is a great start! Thanks @TechGenie-awake
More details you can see here

@khairahscorner khairahscorner merged commit 0185c3a into Women-Coding-Community:main Oct 7, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: Add coverage tests for automation scripts

3 participants