Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor export service to accomodate polling printer and disk #1615

Commits on Jan 17, 2023

  1. Configuration menu
    Copy the full SHA
    c279e61 View commit details
    Browse the repository at this point in the history
  2. Refactor reorganize export module

    The new directory structure will make extension easier.
    gonzalo-bulnes committed Jan 17, 2023
    Configuration menu
    Copy the full SHA
    33cc56d View commit details
    Browse the repository at this point in the history
  3. Refactor use QSignalSpy to assert on signal emissions

    Besides being the dedicated tool to assert on Qt signal emissions,
    QSignalSpy can track when signals are emitted from other signals,
    which the mocking strategy misses.
    
    Example:
    
        some_signal.connect(some_other_signal)
        # verify that some_other_signal is emitted
    
    See https://doc.qt.io/qt-5.15/qsignalspy.html
    gonzalo-bulnes committed Jan 17, 2023
    Configuration menu
    Copy the full SHA
    0c185d2 View commit details
    Browse the repository at this point in the history
  4. Refactor deprecate export.Export test file

    I'll use an expand and contract pattern to refactor
    the export.Service tests, and keeping this file distinct
    while it is used as a reference will be more convenient
    and minimize the change sets.
    
    Important: this file is still fully operational and will be
    kept as such until all deprecated methods have been removed
    from export.Export (soon to be renamed export.Service).
    gonzalo-bulnes committed Jan 17, 2023
    Configuration menu
    Copy the full SHA
    989b94c View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    ee41aa6 View commit details
    Browse the repository at this point in the history
  6. Rename export.Service API signals (backwards compatible)

    Refactor tests to:
    
    - distinguish testing of GUI API, and CLI API internals
    - improve readability
    gonzalo-bulnes committed Jan 17, 2023
    Configuration menu
    Copy the full SHA
    ebb9e51 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    ae7fbb4 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    3869f7b View commit details
    Browse the repository at this point in the history
  9. Refactor extract export CLI interface (part 2)

    Decorate static methods (from what didn't need to be class methods)
    
    Tests were minially modified: patching static methods must be done
    unsing unittest.mock.patch.object to preserve the independence of
    the unit tests. Assigning to the class attributes directly does
    modify the class for the entire test session. (Not desirable.)
    gonzalo-bulnes committed Jan 17, 2023
    Configuration menu
    Copy the full SHA
    e8cfab2 View commit details
    Browse the repository at this point in the history
  10. Refactor remove unused export.Service alias

    I am leaving the deprecated tests as untouched as possible to make
    easier to review the changes.
    gonzalo-bulnes committed Jan 17, 2023
    Configuration menu
    Copy the full SHA
    86def51 View commit details
    Browse the repository at this point in the history
  11. Refactor make export service a module instance

    This will ensure that one one instance of the export service
    queries the sd-devices CLI.
    
    That was already the case, but nothing was done to suggest it.
    
    Additionally, this will allow to simplify the export service
    injection by making possible to retrieve it like a logger.
    
    Note: I haven't stopped injecting the export_service into
    the main.Window because I couldn't figure out how to prevent
    what seems to be a fixture scope error that affects only
    half of the integration tests. That seems like something that
    can be resolved, so I don't consider it to be a sign of
    export.Service being a bad idea.
    gonzalo-bulnes committed Jan 17, 2023
    Configuration menu
    Copy the full SHA
    9c752e9 View commit details
    Browse the repository at this point in the history
  12. Add export.Printer

    gonzalo-bulnes committed Jan 17, 2023
    Configuration menu
    Copy the full SHA
    0d53e22 View commit details
    Browse the repository at this point in the history
  13. Fix polling setup

    gonzalo-bulnes committed Jan 17, 2023
    Configuration menu
    Copy the full SHA
    0130f43 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    073597f View commit details
    Browse the repository at this point in the history
  15. Refactor remove/rename references to preflight checks in export.Servi…

    …ce (1)
    
    These are now replaced by "printer check" and "disk check" which
    have the advantage of referring to concrete physical devices.
    gonzalo-bulnes committed Jan 17, 2023
    Configuration menu
    Copy the full SHA
    d5426ea View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    833f45c View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    e835f3b View commit details
    Browse the repository at this point in the history
  18. Refactor remove deprecated methods, rename for consitency

    Rename disk functions in export.CLI and export.Service
    Rename printer functions in export.CLI and export.Service
    
    The CLI now encapsulates all "preflight" references, so that
    neither the CLI or the Service expose them publicly.
    (References remain on the export.Device and dialogs, but those
    can now be removed for consitency with the export.Service.)
    
    Refactor remove unnecessary methods that were already deprecated
    
    Note: some of the deprecated tests were testing private methods
    that are currectly CLI behavior. This commit moves that testing to
    the appropriate file.
    gonzalo-bulnes committed Jan 17, 2023
    Configuration menu
    Copy the full SHA
    bf80ff3 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    d6bcbbd View commit details
    Browse the repository at this point in the history
  20. Refactor replace deprecated service tests

    With the new separation of concerns, the behavior is tested in three
    differemt component:
    
    - the service, that exposes the public API for the export module
    - the CLI that interfaces the service and Qubes OS tooling
    - the archive that is the CLI relies on but has no relation to Qubes OS
    gonzalo-bulnes committed Jan 17, 2023
    Configuration menu
    Copy the full SHA
    a65b6d0 View commit details
    Browse the repository at this point in the history
  21. Refactor remove unnecessary export.Service injection

    The export.getService() function allows to obtain the export service
    instance wherever necessary without needing to inject it through all
    the parent widgets.
    
    This is a double-edged sword, as it makes the injection more implicit,
    but it is a pattern that is commonly used for singletons, e.g. loggers.
    Use thoughtfully, and remember that injecting the export service
    explicitly in some widgets is always possible!
    
    Next steps: as soon as the export.Device is not longer necessary, then
    the export.Service type doesn't need to be exported anymore.
    gonzalo-bulnes committed Jan 17, 2023
    Configuration menu
    Copy the full SHA
    7b740a8 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    cd62bdd View commit details
    Browse the repository at this point in the history
  23. Add export.Disk

    gonzalo-bulnes committed Jan 17, 2023
    Configuration menu
    Copy the full SHA
    6515406 View commit details
    Browse the repository at this point in the history
  24. Add deprecated interface to export.Disk

    This interface allows to replace the export.Device (deprecated)
    by the export.Disk in the export dialog with minimal changes.
    
    It shouldn't be used for any new developments.
    gonzalo-bulnes committed Jan 17, 2023
    Configuration menu
    Copy the full SHA
    a9b2788 View commit details
    Browse the repository at this point in the history
  25. Ensure export.Disk signals return no errors

    The native errors are already available as disk.last_error.
    gonzalo-bulnes committed Jan 17, 2023
    Configuration menu
    Copy the full SHA
    8a8d8b0 View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    94d7f0c View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    9cf0f2f View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    16aa6ec View commit details
    Browse the repository at this point in the history
  29. Fix flaky test!

    Resetting the export.Service as part of the setup of the tests is
    a compromise. It is a smell, that accurately points at other tests
    not performing an adequate teardown.
    
    I haven't fixed those this time around because the way they are written
    doesn't provide an obvious place to teardown related tests, so adding
    teardown operations introduces a significant amount of duplication.
    
    It seems to me that athough less than ideal, this will prove more
    reliable and more less error-prone for the time being.
    gonzalo-bulnes committed Jan 17, 2023
    Configuration menu
    Copy the full SHA
    ca27689 View commit details
    Browse the repository at this point in the history
  30. Configuration menu
    Copy the full SHA
    4480a41 View commit details
    Browse the repository at this point in the history
  31. Configuration menu
    Copy the full SHA
    bd575de View commit details
    Browse the repository at this point in the history
  32. Configuration menu
    Copy the full SHA
    3a1cdfa View commit details
    Browse the repository at this point in the history
  33. Configuration menu
    Copy the full SHA
    47888de View commit details
    Browse the repository at this point in the history
  34. Configuration menu
    Copy the full SHA
    efe9a15 View commit details
    Browse the repository at this point in the history
  35. Configuration menu
    Copy the full SHA
    add8960 View commit details
    Browse the repository at this point in the history
  36. Configuration menu
    Copy the full SHA
    bdd94e2 View commit details
    Browse the repository at this point in the history
  37. Fix signal type hints

    gonzalo-bulnes committed Jan 17, 2023
    Configuration menu
    Copy the full SHA
    c77817e View commit details
    Browse the repository at this point in the history
  38. Configuration menu
    Copy the full SHA
    c634cee View commit details
    Browse the repository at this point in the history
  39. Configuration menu
    Copy the full SHA
    afd18ec View commit details
    Browse the repository at this point in the history

Commits on Jan 26, 2023

  1. Configuration menu
    Copy the full SHA
    73d82ea View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    fbe4085 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    6d08613 View commit details
    Browse the repository at this point in the history