summaryrefslogtreecommitdiff
path: root/testing/conftest.py
diff options
context:
space:
mode:
authorRonny Pfannschmidt <opensource@ronnypfannschmidt.de>2019-12-14 00:23:40 +0100
committerRonny Pfannschmidt <ronny.pfannschmidt@redhat.com>2020-05-01 22:26:47 +0200
commitb536c087bf5fc76febff44ea38315928beb0e168 (patch)
treed1d668710f3b8c53d925076da9c2144a5e5809f7 /testing/conftest.py
parentc534e8a6dadb0b8830cc79203e62b6a1a966acaf (diff)
downloadsetuptools-scm-workflows.tar.gz
add python testsworkflows
port testsuite to pathlib, and try to resolve windows short paths trace git toplevel mismatch (observed on win32 name shortening) exclude python2 on windows remove the appveyor config, its broken drop most travis envs that we have in github workflows now add actions for creating egg artifacts/wheels/sdists WIP: experiment with act WIP: fix workflow typo WIP: add missed runs-on fix typoed excludes fixup: upload actuall wheel/sdist in the build step style fixes for the actions config
Diffstat (limited to 'testing/conftest.py')
-rw-r--r--testing/conftest.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/testing/conftest.py b/testing/conftest.py
index 0d34731..5cb65f6 100644
--- a/testing/conftest.py
+++ b/testing/conftest.py
@@ -1,6 +1,7 @@
import os
import itertools
import pytest
+import six
os.environ["SETUPTOOLS_SCM_DEBUG"] = "1"
VERSION_PKGS = ["setuptools", "setuptools_scm"]
@@ -21,6 +22,9 @@ class Wd(object):
commit_command = None
add_command = None
+ def __repr__(self):
+ return "<WD {cwd}>".format(cwd=self.cwd)
+
def __init__(self, cwd):
self.cwd = cwd
self.__counter = itertools.count()
@@ -33,10 +37,13 @@ class Wd(object):
return do(cmd, self.cwd)
def write(self, name, value, **kw):
- filename = self.cwd.join(name)
+ filename = self.cwd / name
if kw:
value = value.format(**kw)
- filename.write(value)
+ if isinstance(value, six.text_type):
+ filename.write_text(value)
+ else:
+ filename.write_bytes(value)
return filename
def _reason(self, given_reason):
@@ -83,5 +90,7 @@ def debug_mode():
@pytest.fixture
-def wd(tmpdir):
- return Wd(tmpdir.ensure("wd", dir=True))
+def wd(tmp_path):
+ target_wd = tmp_path.resolve() / "wd"
+ target_wd.mkdir()
+ return Wd(target_wd)