#7 Implement test mode
Merged by salimma. Opened by salimma.
salimma/fedora-business-cards add-test-mode  into  master

Download 7.patch

This implements test mode (so fedora-business-cards can be tested without hitting FAS) in three diffs (the first diff just fixes a typo so is not significant):

  • refactor the extra options parser to be common across all generators
  • add the test mode option
  • implement test mode by refactoring the FAS lookup into a single method that all the collect_information methods make use of

collect_information can be further refactored but that should probably be in a further PR.

Tested by running all three generators in normal, test mode, and test mode with username overridden.

Implements #5

Looks good so far. Can you have a test produce all output formats. I didn't put a ton of detail into #5 - my bad.

My thinking is to have something we can call in a CI system to verify that we get cards as expected. The Inkscape CLI is still not settled and I'd like to stay on top of failures as different Fedora's get different versions.

Also, @salimma - I am going to be away from keyboard for most of next week - so don't let a slow reply bother you please.

@bex sure, I can do that. Two questions then:
- should that be a separate pull request, and we can merge this first?
- is there a preference for which test suite to use (does Fedora projects normally standardize on something e.g. tox?)

I can probably dedicate some time up to verifying that non-empty files are produced, but verifying that we get something graphically meaningful might not be something I'll let someone else tackle.

1 new commit added

  • Test file generation

@bex alright, we now have a test that iterates over all possible output format (except CMYK PDF, will file a bug for it in a bit) and all generators, and verify that they can generate non-empty files.

There is some code duplication, we'll need to refactor the frontend to fix that, but it's probably not a blocker for now.

Instructions in README, but basically python3 -m unittest discover should work (on a system that has fedora-business-cards installed so the dependencies are available).

with a cautionary statement that it is almost midnight ... where are the test files output too? I wanted to review the generator outputs and see if the files "looked" right. Are they saved?

They are currently ephemeral - the test directory gets automatically removed at the end of testing. I can make it output to a known location and preserve the files for further testing, if that's desired?

I'd like that. When I build a new release, I run a copy of each kind of card to verify the output is sane. I don't know of a great way to do that unless we want to embed samples to test for. I have this gut feeling that the outputs are rarely bit-for-bit identical, but I haven't tested that.

Pull-Request has been merged by salimma

Metadata