Repository: pypa/setuptools_scm

Issue:
PRETEND behaviour
Hi,

I am not sure I understand the `SETUPTOOLS_SCM_PRETEND_VERSION` usage.
I use it in a container context where I don't wan't the scm repository to be included in the container image.
Thus I use something like:
```shell
SETUPTOOLS_SCM_PRETEND_VERSION=$(python ${PWD}/setup.py --version) 
```
prior to create the container image so that `setuptools_scm` can retrieve the version without the scm repository. 
However, I don't get the same result as with the scm repository.

With a version like `1.0.1.dev1+ge871260.d20180625` and the scm repository, the generated artifact (here a wheel) will be `my_python_project-1.0.1.dev1+ge871260.d20180625-py3-none-any.whl`, while without the scm repository and with `SETUPTOOLS_SCM_PRETEND_VERSION` set to `1.0.1.dev1+ge871260.d20180625` the generated artifact is `my_python_project-1.0.1.dev1-py3-none-any.whl`.

Looking at the `_do_parse` function code:
```python
if pretended:
        # we use meta here since the pretended version
        # must adhere to the pep to begin with
        return meta(pretended)
```
I understand this is done on purpose, but I don't get why.
I would expect the result to be the same, unless I don't get the `SETUPTOOLS_SCM_PRETEND_VERSION` usage properly.

Comments:

Patch:
diff --git a/src/setuptools_scm/__init__.py b/src/setuptools_scm/__init__.py
index b256289..8ea3136 100644
--- a/src/setuptools_scm/__init__.py
+++ b/src/setuptools_scm/__init__.py
@@ -60,7 +60,7 @@ def _do_parse(root, parse):
     if pretended:
         # we use meta here since the pretended version
         # must adhere to the pep to begin with
-        return meta(pretended)
+        return meta(tag=pretended, preformatted=True)
 
     if parse:
         parse_result = parse(root)
diff --git a/tox.ini b/tox.ini
index 1281b87..c5edb78 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
 [tox]
-envlist=py{27,34,35,36,37}-test,flake8,check_readme,py{27,36}-selftest
+envlist=py{27,34,35,36,37}-test,flake8,check_readme,py{27,36}-selfcheck
 
 [flake8]
 max-complexity = 10
@@ -39,7 +39,7 @@ deps=
     readme
     check-manifest
 commands=
-    python setup.py check -r -s
+    python setup.py check -r
     rst2html.py README.rst {envlogdir}/README.html --strict []
     check-manifest
 


Test patch:
diff --git a/testing/test_basic_api.py b/testing/test_basic_api.py
index b26688b..6d7f112 100644
--- a/testing/test_basic_api.py
+++ b/testing/test_basic_api.py
@@ -51,10 +51,12 @@ def test_root_parameter_pass_by(monkeypatch, tmpdir):
     setuptools_scm.get_version(root=tmpdir.strpath)
 
 
-def test_pretended(monkeypatch):
-    pretense = "2345"
-    monkeypatch.setenv(setuptools_scm.PRETEND_KEY, pretense)
-    assert setuptools_scm.get_version() == pretense
+@pytest.mark.parametrize(
+    "version", ["1.0", "1.2.3.dev1+ge871260", "1.2.3.dev15+ge871260.d20180625", "2345"]
+)
+def test_pretended(version, monkeypatch):
+    monkeypatch.setenv(setuptools_scm.PRETEND_KEY, version)
+    assert setuptools_scm.get_version() == version
 
 
 def test_root_relative_to(monkeypatch, tmpdir):
diff --git a/testing/test_functions.py b/testing/test_functions.py
index db573ac..6c82b32 100644
--- a/testing/test_functions.py
+++ b/testing/test_functions.py
@@ -72,10 +72,13 @@ def test_dump_version_doesnt_bail_on_value_error(tmpdir):
     assert str(exc_info.value).startswith("bad file format:")
 
 
-def test_dump_version_works_with_pretend(tmpdir, monkeypatch):
-    monkeypatch.setenv(PRETEND_KEY, "1.0")
+@pytest.mark.parametrize(
+    "version", ["1.0", "1.2.3.dev1+ge871260", "1.2.3.dev15+ge871260.d20180625"]
+)
+def test_dump_version_works_with_pretend(version, tmpdir, monkeypatch):
+    monkeypatch.setenv(PRETEND_KEY, version)
     get_version(write_to=str(tmpdir.join("VERSION.txt")))
-    assert tmpdir.join("VERSION.txt").read() == "1.0"
+    assert tmpdir.join("VERSION.txt").read() == version
 
 
 def test_has_command(recwarn):