Added unit tests for rbt alias command

Review Request #10989 — Created April 5, 2020 and submitted

Information

RBTools
release-2.0.x

Reviewers

Added unit tests for rbt alias command

Test cases run on python 2.7.17 and 3.7.6.

- Test case validating output for '--list' option with defined alias
- Test case validating output for '--list' option  with undefined alias
- Test case validating '--list' option in debug mode
- Test case validating output for '--dry-run' option with defined alias
- Test case validating output for '--dry-run' option with undefined alias
- Test case validating  '--dry-run' option with missing arg
- Test case validating '--dry-run' option in debug mode
Summary ID Author
Added unit tests for rbt alias command
Testing Done: Test cases run on python 2.7.17 and 3.7.6. - Test case validating output for '--list' option with defined alias - Test case validating output for '--list' option with undefined alias - Test case validating '--list' option in debug mode - Test case validating output for '--dry-run' option with defined alias - Test case validating output for '--dry-run' option with undefined alias - Test case validating '--dry-run' option with missing arg - Test case validating '--dry-run' option in debug mode
3ee90965956ba576879adf9f590a423e6ecc8f45 kpatenio
Description From Last Updated

For mentors: flake8 does not seem to like the fact that I have repeated dictionary keys in a couple test …

kpateniokpatenio

Since this can get a bit weird-looking, the pattern we prefer is: config = { 'ALIASES': { ... } } …

chipx86chipx86

F601 dictionary key u'alias1' repeated with different values

reviewbotreviewbot

F601 dictionary key u'alias1' repeated with different values

reviewbotreviewbot

F601 dictionary key u'alias1' repeated with different values

reviewbotreviewbot

F601 dictionary key u'alias1' repeated with different values

reviewbotreviewbot

Mentioned this in another review request, but you'll want to use += for consistency and performance (this isn't performance-critical code, …

chipx86chipx86
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

kpatenio
  1. 
      
  2. Show all issues

    For mentors: flake8 does not seem to like the fact that I have repeated dictionary keys in a couple test cases that I made.

    Would you recommend I ignore these? Or should I omit this type of test case from my unit tests?

    1. Repeated dictionary keys will get filtered out, so they are a problem. Only one key will win, and which one will depend on the version of Python you're working with. You're probably not getting the testing you're expecting with that.

    2. Ah that's interesting. Considering that the key chosen depends on the Python version, I feel inclined to remove these tests for now.

  3. 
      
chipx86
  1. 
      
  2. rbtools/commands/tests/test_alias.py (Diff revision 1)
     
     
     
     
     
    Show all issues

    Since this can get a bit weird-looking, the pattern we prefer is:

    config = {
        'ALIASES': {
            ...
        }
    }
    
    with self.reviewboardrc(config):
        ...
    

    Keeps it a lot more manageable.

  3. rbtools/commands/tests/test_alias.py (Diff revision 1)
     
     
    Show all issues

    Mentioned this in another review request, but you'll want to use += for consistency and performance (this isn't performance-critical code, but still worth doing).

  4. 
      
kpatenio
kpatenio
david
  1. Ship It!
  2. 
      
kpatenio
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.0.x (9cf668a)
Loading...