Skip to content

test(ftp): verify no FTP connection on import or initialization - #316

Merged
luabida merged 1 commit into
AlertaDengue:mainfrom
roshanData:fix/avoid-ftp-connection-on-import
Aug 14, 2026
Merged

test(ftp): verify no FTP connection on import or initialization#316
luabida merged 1 commit into
AlertaDengue:mainfrom
roshanData:fix/avoid-ftp-connection-on-import

Conversation

@roshanData

Copy link
Copy Markdown
Contributor

Description

This PR adds regression tests to ensure importing \pysus\ modules and instantiating \FTP\ or \PySUS\ clients does not trigger an eager FTP network connection to DATASUS servers.

Motivation

In environments with restricted network access or during offline development, importing library modules should be fast and reliable without attempting unrequested network connections or failing with socket errors.

Changes

  • Added unit tests in \pysus/tests/api/ftp/test_client.py:
    • \ est_ftp_init_does_not_connect: Verifies \FTP()\ instantiation leaves internal connection idle without connecting.
    • \ est_import_does_not_connect_ftp: Verifies importing \pysus, \pysus.api, \pysus.api.ftp, and initializing \PySUS()\ performs zero calls to \ tplib.FTP.

Validation

  • Full test suite: 660 passed (\pytest -q).
  • Linters passed: \�lack, \isort, and \ lake8\ with 0 errors.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@543164e). Learn more about missing BASE report.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #316   +/-   ##
=======================================
  Coverage        ?   97.90%           
=======================================
  Files           ?       49           
  Lines           ?     8513           
  Branches        ?        0           
=======================================
  Hits            ?     8335           
  Misses          ?      178           
  Partials        ?        0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@luabida
luabida merged commit 0f47a64 into AlertaDengue:main Aug 14, 2026
14 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.8.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants