-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Long parametrized test_input on Windows: ValueError: the environment variable is longer than 32767 characters #6881
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
Comments
Re: long name in logs, passing (which might also work around the env issue? unclear, but we should fix that anyway.) |
Thanks, passing @pytest.mark.parametrize(
"test_input",
[
"1",
"2",
"[" * (1024 * 1024),
"{" * (1024 * 1024),
],
ids=["a", "b", "c", "d"]
)
def test_long_input(test_input):
pass (Although there are 30 params in the real test, so I'd opt for the method splitting workaround in this case.) |
Note that you can pass a function to |
i believe this is one of the c ases where pytest should not consider the string as valid id and hint and pasing a explicit name, autogenerating the test name instead aka |
@RonnyPfannschmidt / @nicoddemus any recommendations on where the fix should live? but where do we draw the line here? a few queries from my initial investigation:
|
I would draw the line around 100, maybe less |
ok I will mock something up and discuss via PR, I think we have a few areas where maybe we should consider a --windows based flag that does a couple of things, 2-3 issue's ive seen are similar in nature to this but in different parts of the system, relating to file lengths or env var lengths etc :) |
Any progress on this issue? We were still able to replicate it with latest pytest (3 years later). Was this just forgotten about, or is it a wontfix? Even worse, it seems that doing: @pytest.mark.skipif(platform.system() == "Windows", reason="environment variable limit on Windows")
@pytest.mark.parametrize(("string"), ["a" * (32768)])
def test_write_utf_limit(string):
... Causes the test to be skipped, but also failed somehow. I suspect that it's because the error occurred during parametrization, so even though the test function didn't actually run, it still failed. See: commit that caused this, along with the corresponding failure in it's CI run Although the suggested fix by setting |
Nobody took the time to fix it, but a pull request would be certainly welcome. |
The open pull request went stale it seems |
@symonk - the discussion here points to following a different approach, so I think it's ok to close this one then, right? |
@obestwalter I opened this issue, and @symonk opened a PR linked to this issue. Is "close this one" referring to the PR linked to this issue, or is it referring to this issue? |
@kurtmckee yes it's about the PR that is not the preferred solution anymore. I actually should have written it there. Thanks for clearing that up. |
Thanks @kurtmckee for picking this up, let's move the discussion back here then as the first PR to address this is likely to be closed soon then. You wrote:
My head is spinning from going through tons of Issues and PRs over the last few days after not really having followed the developments for a long time. But from my shallow understanding doing it like this is fixing the problem and letting the user know that something potentially surprising has been done to address it, giving them the info needed to handle it differently if they so wish. So sounds like a good plan to me. |
I agree with #7254 (comment) too. |
pip list
from the virtual environment you are usingpytest 5.3.5, Windows Server 2019 on GitHub Actions
Python 3.5-3.8
Include long test input in a
parametrize
test:Expected
Tests pass
Actual
Tests fail with
ValueError: the environment variable is longer than 32767 characters
:https://github.com/hugovk/ultrajson/runs/493853892?check_suite_focus=true
Passes on Ubuntu 16.04, 18.04, macOS Catalina 10.15 with Python 2.7, 3.5-3.8, but for all operating systems the test name is also really long because it includes the parameterised values, which clutters the logs.
Can be worked around by splitting the long test input into its own method:
The text was updated successfully, but these errors were encountered: