Skip to content

Conversation

@belono
Copy link
Contributor

@belono belono commented Oct 8, 2025

Description

This is part 4 of the series to improve and extend the availability of the _read() method.

Part 1: #709

Part 2: #711

Part 3: #712

Part 4: Add the _read() method to the Dummy() connector:

This adds an initial implementation of the _read() method to the Dummy() connector that, until now, was lacking this feature and was raising a NotImplementedError exception.

Note that this is only useful for testing as no real response can be obtained from any printer by the Dummy connector.

Features:

  • Implement the _read() method on the Dummy() class.
  • Add and group the new tests plus the existing one into a new test file located at test/test_printers/test_printer_dummy.py.

Tests will be added in a later PR.

Tested with

Dummy printer

@codecov
Copy link

codecov bot commented Oct 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.31%. Comparing base (11d46fd) to head (da86a28).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #714      +/-   ##
==========================================
- Coverage   81.39%   81.31%   -0.08%     
==========================================
  Files          21       21              
  Lines        1693     1697       +4     
  Branches      267      268       +1     
==========================================
+ Hits         1378     1380       +2     
  Misses        235      235              
- Partials       80       82       +2     
Flag Coverage Δ
unittests 81.26% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/escpos/printer/dummy.py 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

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

@belono
Copy link
Contributor Author

belono commented Oct 20, 2025

While writing the tests for this feature I realized that the return value of _read() was wrong so I fixed it.

@belono
Copy link
Contributor Author

belono commented Oct 20, 2025

I've added a new test file for the dummy printer that groups the tests for its new _read() method and an existing test for its clear() method that was into a separate file before this commit, so I deleted that file.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant