~rjarry/aerc-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
4 3

[PATCH aerc] xdg: fix unit tests on macos

Details
Message ID
<20230829074756.30070-2-robin@jarry.cc>
DKIM signature
missing
Download raw message
Patch: +4 -0
When any XDG_*_HOME or XDG_RUNTIME_DIR variables are set, this causes
test failures.

 FAIL: TestConfigPath//home/user/Library/Preferences/aerc/accounts.conf (0.00s)
   xdg_test.go:86: got "/Users/vitaly/.config/aerc/accounts.conf"
              expected "/home/user/Library/Preferences/aerc/accounts.conf"

Avoid leaking the local user's environment in the unit tests. Always
override the XDG_* variables.

Fixes: fff16640ad7c ("xdg: add functions to deal with user home paths")
Reported-by: Vitaly Ovchinnikov <v@postbox.nz>
Signed-off-by: Robin Jarry <robin@jarry.cc>
---
 lib/xdg/xdg_test.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/xdg/xdg_test.go b/lib/xdg/xdg_test.go
index 6b8eac35cad2..8ab68e060d4c 100644
--- a/lib/xdg/xdg_test.go
+++ b/lib/xdg/xdg_test.go
@@ -14,6 +14,7 @@ func TestCachePath(t *testing.T) {
	}{
		{
			args: []string{"aerc", "foo", "history"},
			env:  map[string]string{"XDG_CACHE_HOME": ""},
			expected: map[string]string{
				"":       "/home/user/.cache/aerc/foo/history",
				"darwin": "/home/user/Library/Caches/aerc/foo/history",
@@ -56,6 +57,7 @@ func TestConfigPath(t *testing.T) {
	}{
		{
			args: []string{"aerc", "accounts.conf"},
			env:  map[string]string{"XDG_CONFIG_HOME": ""},
			expected: map[string]string{
				"":       "/home/user/.config/aerc/accounts.conf",
				"darwin": "/home/user/Library/Preferences/aerc/accounts.conf",
@@ -98,6 +100,7 @@ func TestDataPath(t *testing.T) {
	}{
		{
			args: []string{"aerc", "templates"},
			env:  map[string]string{"XDG_DATA_HOME": ""},
			expected: map[string]string{
				"":       "/home/user/.local/share/aerc/templates",
				"darwin": "/home/user/Library/Application Support/aerc/templates",
@@ -145,6 +148,7 @@ func TestRuntimePath(t *testing.T) {
	}{
		{
			args: []string{"aerc.sock"},
			env:  map[string]string{"XDG_RUNTIME_DIR": ""},
			expected: map[string]string{
				"":       "/run/user/1000/aerc.sock",
				"darwin": "/home/user/Library/Application Support/aerc.sock",
-- 
2.41.0

[aerc/patches] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CV4V6ZTLM2CB.WYPTYQYXYJOZ@cirno2>
In-Reply-To
<20230829074756.30070-2-robin@jarry.cc> (view parent)
DKIM signature
missing
Download raw message
aerc/patches: SUCCESS in 4m59s

[xdg: fix unit tests on macos][0] from [Robin Jarry][1]

[0]: https://lists.sr.ht/~rjarry/aerc-devel/patches/44102
[1]: robin@jarry.cc

✓ #1049341 SUCCESS aerc/patches/openbsd.yml     https://builds.sr.ht/~rjarry/job/1049341
✓ #1049340 SUCCESS aerc/patches/alpine-edge.yml https://builds.sr.ht/~rjarry/job/1049340
Details
Message ID
<CVMZ9EMCGY1W.I1TZGISHEVPS@ringo>
In-Reply-To
<20230829074756.30070-2-robin@jarry.cc> (view parent)
DKIM signature
missing
Download raw message
Robin Jarry, Aug 29, 2023 at 09:47:
> When any XDG_*_HOME or XDG_RUNTIME_DIR variables are set, this causes
> test failures.
>
>  FAIL: TestConfigPath//home/user/Library/Preferences/aerc/accounts.conf (0.00s)
>    xdg_test.go:86: got "/Users/vitaly/.config/aerc/accounts.conf"
>               expected "/home/user/Library/Preferences/aerc/accounts.conf"
>
> Avoid leaking the local user's environment in the unit tests. Always
> override the XDG_* variables.
>
> Fixes: fff16640ad7c ("xdg: add functions to deal with user home paths")
> Reported-by: Vitaly Ovchinnikov <v@postbox.nz>
> Signed-off-by: Robin Jarry <robin@jarry.cc>

Hi Vitaly,

did you test this on macos?
Details
Message ID
<CVN0TYSKA6KW.2H4U1VGCX6X5V@postbox.nz>
In-Reply-To
<CVMZ9EMCGY1W.I1TZGISHEVPS@ringo> (view parent)
DKIM signature
missing
Download raw message
> did you test this on macos?

Never tried applying a patch before, sorry :)

Got this one a try and can confirm that the current master without the
patch fails `go test ./...` and the patched version passes it.

Tested-by: Vitaly Ovchinnikov <v@postbox.nz>

Is the above line correct?
Details
Message ID
<CVN74HYVFMLC.1SXB4BDH89Q6Y@ringo>
In-Reply-To
<CVN0TYSKA6KW.2H4U1VGCX6X5V@postbox.nz> (view parent)
DKIM signature
missing
Download raw message
Vitaly Ovchinnikov, Sep 19, 2023 at 18:06:
> > did you test this on macos?
>
> Never tried applying a patch before, sorry :)
>
> Got this one a try and can confirm that the current master without the
> patch fails `go test ./...` and the patched version passes it.
>
> Tested-by: Vitaly Ovchinnikov <v@postbox.nz>
>
> Is the above line correct?

Yes, perfect :)

Applied. Thanks!
Reply to thread Export thread (mbox)