remove more of the mypy ignore list#830
Conversation
52250fc to
16fe242
Compare
| @@ -163,10 +163,9 @@ def __init__( | |||
|
|
|||
| # set the output of gurobi | |||
| if not self.msg: | |||
There was a problem hiding this comment.
this is unrelated, just saw it as I was reading the code.
| pass | ||
|
|
||
|
|
||
| def is_single_use_license() -> bool: |
There was a problem hiding this comment.
the SkipTest decorators below failed to type check. I was deciding between this and just unilateral skip with @unittest.skip. Happy to go the other way if you want.
There was a problem hiding this comment.
I don't really understand the difference between unittest.SkipTest and unittest.skip. Maybe @torressa knows ?
There was a problem hiding this comment.
I think they can be changed to unittest.skip. Not sure about the SkipTest decorator is working as expected anymore. In any case, we really want to skip these as they are only relevant when using a specific license (single use).
There was a problem hiding this comment.
Is there a way to check for the single use license inside the is_single_use_license function and return true/false?
There was a problem hiding this comment.
With gurobipy one could do:
def is_single_use_license() -> bool:
try:
with gp.Env() as env1:
with gp.Env() as env2:
pass
except gp.GurobiError as ge:
if ge.errno == gp.GRB.Error.NO_LICENSE:
print("single use license")
print(f"Error code {ge.errno}: {ge}")
return True
return FalseThis is enough to trigger an error in a single-use case.
| self.assertEqual(str(c1_variable), str(2 * x + y <= 5)) | ||
| self.assertEqual(repr(c1_variable), repr(2 * x + y <= 5)) | ||
|
|
||
| expr: LpAffineExpression = x + 1 |
There was a problem hiding this comment.
mypy complains about these type hints since these variables are already defined.
|
I have put in the implementation supplied by @torressa. Thanks! On my machine these tests are still skipped. If you have a single-use license environment to play with it might be good to verify that they are run and pass. |
|
it seems to still fail with the current changes, @frrad could you take a look? thanks! |
|
It was working! I wonder what changed 🤔 will take a look. |
|
Fixed! Looks like some minor conflict with #831 |
This removes the last of the "real" exceptions from
pyproject.toml, addingtype: ignoreas needed.