Repository navigation
Conversation
187b4ea to
2df3a65
Compare
maxnbk
left a comment
There was a problem hiding this comment.
Overall the fix is correct and minimal, and addresses the crash.
Biggest issue is just a lack of tests, so that we don't regress, and so that if, hypothetically, setenv ever returned something, this issue wouldn't reappear.
Something as simple of this might work?
def test_resetenv(self) -> None:
"""Test that resetenv doesn't crash and sets the variable."""
r = ResolvedContext(["hello_world"])
# This would crash with TypeError before the fix
environ = r.get_environ()
Though better yet, a unit test in text_rex.py that called resetenv on a python interpreter (which would run everywhere and be independent of shell support) and verifies no crash, followed by an integration test in test_shells.py that calls resetenv through an actual shell and verifies the output doesn't contain None.
Other than that it just needs a rebase (sorry for not getting to review this sooner).
@czerouni , if you don't think you'll have the time to work on tests for this, I would not mind working on top of your branch to add some. LMK either way, but I won't unless noted.
|
Thanks. That's a reasonable request - let me see if I can get to that in the next few days.
…On Sat, Aug 1, 2026 at 1:47 PM Stephen Mackenzie ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Overall the fix is correct and minimal, and addresses the crash.
Biggest issue is just a lack of tests, so that we don't regress, and so
that if, hypothetically, setenv ever returned something, this issue
wouldn't reappear.
Something as simple of this might work?
def test_resetenv(self) -> None:
"""Test that resetenv doesn't crash and sets the variable."""
r = ResolvedContext(["hello_world"])
# This would crash with TypeError before the fix
environ = r.get_environ()
Though better yet, a unit test in text_rex.py that called resetenv on a
python interpreter (which would run everywhere and be independent of shell
support) and verifies no crash, followed by an integration test in
test_shells.py that calls resetenv through an actual shell and verifies
the output doesn't contain None.
Other than that it just needs a rebase (sorry for not getting to review
this sooner).
@czerouni <https://github.com/czerouni> , if you don't think you'll have
the time to work on tests for this, I would not mind working on top of your
branch to add some. LMK either way, but I won't unless noted.
—
Reply to this email directly, view it on GitHub
<#2070?email_source=notifications&email_token=AB46ZJJYMDXB2OE5ZYSTUED5HZJPLA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTIOBTGU3TCNJRGYZ2M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#pullrequestreview-4835715163>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB46ZJLMM56C7M4NAF6MH6L5HZJPLAVCNFSNUABDKJSXA33TNF2G64TZHM2DANJSGAZDCO2JONZXKZJ3GM4DANBYG43TANRRUF3AE>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AB46ZJIPI2UHMRHHMVJOGST5HZJPLA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTIOBTGU3TCNJRGYZ2M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/AB46ZJINI2OHLZLMTIZM3KT5HZJPLA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTIOBTGU3TCNJRGYZ2M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2070 +/- ##
==========================================
+ Coverage 62.64% 62.68% +0.03%
==========================================
Files 165 165
Lines 20792 20792
Branches 3621 3621
==========================================
+ Hits 13026 13034 +8
+ Misses 6886 6878 -8
Partials 880 880 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
I think this is ready, but I have a question: how are you running the ruff checks locally? There is no |
The ruff setup is pretty brand-new, so I don't think it's been fully worked out. To do my own ruff checks, I had to |
resetenv() appended the return value of setenv() to the shell script - which is always None - producing a 'None' command line and a traceback whenever resetenv() was used (AcademySoftwareFoundation#2068). Since the current behaviour of a working resetenv() is identical to setenv(), resetenv() now simply defers to setenv(). Adds tests: a Resetenv action in the rex round-trip tests (test_rex.py) and a per-shell output test that resetenv does not crash (test_shells.py). The unused 'friends' parameter is retained as-is; whether resetenv() should be fully implemented per the rezconfig.py description or removed is left as a design question for review. Signed-off-by: Craig Zerouni <czerouni@gmail.com>
4166538 to
c60abb6
Compare
|
This issue should probably be followed-up by a deprecation-level design decision of "Should resetenv be removed or actually-fully-implemented", but this PR will serve as a fix-PR to remove the crashing behavior, which is the scope for this PR. Leaving this comment as a reminder for me to create an issue for it before merging/discarding. |
Fixes #2068
While trying to document resetenv() (which had a TODO in the docs) I noticed that Rez would always generate a python traceback when resetenv() was called.
The reason for this turns out to be that it is creating a "command" that is None because it is adding a line that is the return value of setenv. But that is always None. In any case, it doesn't do what rezconfig.py suggests it might. And it has a "friends" parameter that isn't used and whose purpose I couldn't guess at.
This PR "fixes" that by just having calls to resetenv() defer to setenv() since that is all that would currently happen even if it worked. As an aside, I think that resetenv should either be removed, or implemented as rezconfig.py implies.