Skip to content

Commit

Permalink
unittests: use property for rarely used directories
Browse files Browse the repository at this point in the history
This avoids having to set them up in cases we don't use them, or
override them in cases where we change the build directory
  • Loading branch information
dcbaker committed Aug 26, 2024
1 parent b630ffb commit 4c9587c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions unittests/baseplatformtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,18 @@ def setUp(self):
self.meson_cross_files = []
self.new_builddir()

@property
def privatedir(self) -> str:
return os.path.join(self.builddir, 'meson-private')

@property
def distdir(self) -> str:
return os.path.join(self.builddir, 'meson-dist')

def change_builddir(self, newdir):
self.builddir = newdir
self.privatedir = os.path.join(self.builddir, 'meson-private')
self.logdir = os.path.join(self.builddir, 'meson-logs')
self.installdir = os.path.join(self.builddir, 'install')
self.distdir = os.path.join(self.builddir, 'meson-dist')
self.mtest_command = self.meson_command + ['test', '-C', self.builddir]
if os.path.islink(newdir):
self.addCleanup(os.unlink, self.builddir)
Expand Down Expand Up @@ -199,7 +205,6 @@ def init(self, srcdir, *,
args += ['--native-file', f]
for f in self.meson_cross_files:
args += ['--cross-file', f]
self.privatedir = os.path.join(self.builddir, 'meson-private')
if inprocess:
try:
returncode, out, err = run_configure_inprocess(['setup'] + self.meson_args + args + extra_args + build_and_src_dir_args, override_envvars)
Expand Down

0 comments on commit 4c9587c

Please sign in to comment.