-
-
Notifications
You must be signed in to change notification settings - Fork 411
remove more of the mypy ignore list #830
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is unrelated, just saw it as I was reading the code.
@@ -14,6 +14,15 @@ def check_dummy_env(): | |||
pass | |||
|
|||
|
|||
def is_single_use_license() -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really understand the difference between unittest.SkipTest
and unittest.skip
. Maybe @torressa knows ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 False
This is enough to trigger an error in a single-use case.
@@ -1574,7 +1576,7 @@ def test_constraint_add(self): | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: ignore
as needed.