Fix some test skipping issues.

Review Request #11871 — Created Nov. 10, 2021 and submitted

Information

Review Board
release-4.0.x

Reviewers

There are two issues with test skipping that I ran into with my
work-in-progress M1 configuration:

  1. Perforce tests were set up to skip if the P4 module wasn't available,
    but at some point we had an import of P4Exception snuck in that
    wasn't properly guarded. This change makes it so that we properly
    skip the test without hitting ImportError.
  2. Once upon a time, paramiko just allowed SocketError to raise when
    port 22 was closed, but now it has its own error class.

Ran unit tests.

Summary ID
Fix some test skipping issues.
There are two issues with test skipping that I ran into with my work-in-progress M1 configuration: 1. Perforce tests were set up to skip if the P4 module wasn't available, but at some point we had an import of P4Exception snuck in that wasn't properly guarded. This change makes it so that we properly skip the test without hitting `ImportError`. 2. Once upon a time, paramiko just allowed `SocketError` to raise when port 22 was closed, but now it has its own error class. Testing Done: Ran unit tests.
f1a9a680513d413bffc5d747f615562a913e7865
Description From Last Updated

F811 redefinition of unused 'P4Exception' from line 10

reviewbotreviewbot

I made a similar change for P4, except I aliased this to Exception. I don't think either approach is better …

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

flake8

david
chipx86
  1. 
      
  2. Show all issues

    I made a similar change for P4, except I aliased this to Exception. I don't think either approach is better than the other right now, but since some tests do simulate P4 operations and work without having p4python installed, I err'd on the side of keeping P4Exception operational. What do you think?

    1. The only tests that aren't skipped when P4 is unavailable are PerforceAuthFormTests, which doesn't use P4Exception at all. I don't know that we gain much from being piecemeal here--if people are making changes that affect Perforce then they should have p4python and run all p4 tests.

  3. 
      
chipx86
  1. Ship It!
  2. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to release-4.0.x (2ed51aa)