Skip to content

Commit e88a2f8

Browse files
authored
python commons (fixes #45 via #50)
* set alluredir to envtemp in tox ini * add gitignore * separate logic and files
1 parent b8dd416 commit e88a2f8

File tree

15 files changed

+124
-59
lines changed

15 files changed

+124
-59
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.idea
2+
.tox
3+
.cache
4+
.python-version
5+
6+
*.pyc
7+
*.egg-info

allure-pytest/README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
# Allure pytest plugin
22

3-
## Installation
4-
Beta version is not available on PyPI, but you can install allure directly from github:
3+
## Installation
4+
In process. We are hope to get beta on PyPi in april
5+
56

6-
```bash
7-
$ pip install -e 'git+https://github.com/allure-framework/allure-python2.git#egg=pytest_allure_adaptor&subdirectory=allure-pytest'
8-
```
97
## Changes
108

119
### Attachments

allure-pytest/setup.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
import sys
21
from setuptools import setup
32

43
PACKAGE = "pytest-allure-adaptor"
54
VERSION = "2.0.3"
65

76
install_requires = [
87
"pytest>=2.7.3",
9-
"attrs>=16.0.0",
8+
"allure-python-commons==2.0.3"
109
]
1110

12-
if sys.version_info < (3, 4):
13-
install_requires.append("enum34")
14-
1511
def main():
1612
setup(
1713
name=PACKAGE,

allure-pytest/src/allure/helper.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import pytest
2-
32
from functools import wraps
3+
from allure_commons.utils import uuid4
44

5-
from allure.utils import uuid4
65
from allure.utils import step_parameters
7-
from allure.constants import Severity
8-
from allure.constants import ALLURE_LABEL_PREFIX, ALLURE_LINK_PREFIX
9-
from allure.constants import LabelType, LinkType, AttachmentType
6+
from allure.utils import ALLURE_LABEL_PREFIX, ALLURE_LINK_PREFIX
7+
8+
from allure_commons.constants import Severity
9+
from allure_commons.constants import LabelType, LinkType, AttachmentType
1010

1111

1212
class AllureTestHelper(object):

allure-pytest/src/allure/listener.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import pytest
22

3-
from allure.logger import AllureLogger
4-
from allure.utils import now
5-
from allure.utils import uuid4
3+
from allure_commons.utils import now
4+
from allure_commons.utils import uuid4
5+
from allure_commons.logger import AllureLogger
6+
from allure_commons.model2 import TestStepResult, TestResult, TestBeforeResult, TestAfterResult
7+
from allure_commons.model2 import TestResultContainer
8+
from allure_commons.model2 import StatusDetails
9+
from allure_commons.model2 import Parameter
10+
from allure_commons.model2 import Label, Link
11+
from allure_commons.model2 import Status
12+
613
from allure.utils import allure_parameters
714
from allure.utils import allure_labels, allure_links
815
from allure.utils import allure_full_name, allure_package
9-
from allure.model2 import TestStepResult, TestResult, TestBeforeResult, TestAfterResult
10-
from allure.model2 import TestResultContainer
11-
from allure.model2 import StatusDetails
12-
from allure.model2 import Parameter
13-
from allure.model2 import Label, Link
14-
from allure.constants import Status
1516

1617

1718
class AllureListener(object):

allure-pytest/src/allure/pytest_plugin.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1+
import pytest
12
import argparse
3+
from six import text_type
24

3-
import pytest
5+
from allure_commons.constants import Severity
6+
from allure_commons.constants import LabelType
47

8+
from allure.utils import allure_labels
59
from allure.helper import AllureTestHelper
610
from allure.listener import AllureListener
7-
from allure.constants import Severity
8-
from allure.constants import LabelType
9-
from allure.utils import allure_labels
10-
from six import text_type
1111

1212

1313
def pytest_addoption(parser):

allure-pytest/src/allure/utils.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
11
import os
2-
import time
3-
import uuid
4-
from itertools import product
52
import inspect
3+
from itertools import product
64

7-
from allure.constants import ALLURE_LABEL_PREFIX
8-
from allure.constants import ALLURE_LINK_PREFIX
9-
from allure.constants import ALLURE_UNIQUE_LABELS
10-
11-
12-
def uuid4():
13-
return str(uuid.uuid4())
5+
from allure_commons.constants import ALLURE_UNIQUE_LABELS
146

157

16-
def now():
17-
return int(round(1000 * time.time()))
8+
ALLURE_LABEL_PREFIX = 'allure_label'
9+
ALLURE_LINK_PREFIX = 'allure_link'
1810

1911

2012
def allure_parameters(fixturedef, request):

allure-pytest/tox.ini

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,29 @@
11
[tox]
22
envlist=
3-
py27,py33,py34,py35,static_check
3+
py{27,33,34,35}
4+
static_check
45

56

67
[testenv]
8+
whitelist_externals = rm
9+
710
deps=
8-
pytest
911
pyhamcrest
12+
{distshare}/allure-python-commons-*.zip
1013

1114
commands=
1215
python setup.py develop
13-
py.test --doctest-module --alluredir=./report/ ./test/
16+
rm -f {envtmpdir}/*.json
17+
py.test --doctest-module --alluredir={envtmpdir} ./test/
18+
19+
20+
[testenv:demo]
21+
whitelist_externals = rm
1422

23+
commands=
24+
python setup.py develop
25+
rm -f {envtmpdir}/*.json
26+
- py.test --alluredir={envtmpdir} ./test/
1527

1628
[testenv:static_check]
1729
deps=

allure-python-commons/setup.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import sys
2+
from setuptools import setup
3+
4+
PACKAGE = "allure-python-commons"
5+
VERSION = "2.0.3"
6+
7+
8+
install_requires = [
9+
"attrs>=16.0.0",
10+
]
11+
12+
if sys.version_info < (3, 4):
13+
install_requires.append("enum34")
14+
15+
16+
def main():
17+
setup(
18+
name=PACKAGE,
19+
version=VERSION,
20+
packages=['allure_commons'],
21+
package_dir={'allure_commons': 'src'},
22+
install_requires=install_requires
23+
)
24+
25+
if __name__ == '__main__':
26+
main()

allure-python-commons/src/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)