Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,9 @@ addopts = [
"--strict-markers",
"--doctest-modules"
]

[tool.isort]
profile = "black"
line_length = 100
force_single_line = true
skip_gitignore = true
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ packaging==21.0
pyparsing==2.4.7
semantic-version==2.8.5
semver==2.13.0
isort==5.10.1
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ testing =
aboutcode-toolkit >= 6.0.0
black
commoncode
isort>=5.10.1

docs =
Sphinx >= 3.3.1
Expand Down
2 changes: 1 addition & 1 deletion src/univers/debian.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
from itertools import zip_longest

from attr import asdict
from attr import attrs
from attr import attrib
from attr import attrs

logger = logging.getLogger(__name__)

Expand Down
1 change: 1 addition & 0 deletions src/univers/version_constraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from functools import total_ordering

import attr

from univers.utils import remove_spaces
from univers.versions import Version

Expand Down
4 changes: 2 additions & 2 deletions src/univers/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#
# Visit https://aboutcode.org and https://github.com/nexB/univers for support and download.

from functools import total_ordering
import functools
from functools import total_ordering

import attr
import semantic_version
Expand All @@ -14,9 +14,9 @@
from univers import arch
from univers import debian
from univers import gem
from univers import nuget
from univers import gentoo
from univers import maven
from univers import nuget
from univers import rpm
from univers.utils import remove_spaces

Expand Down
1 change: 0 additions & 1 deletion tests/nuget/test_nuget_floating_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from univers.version_range import NugetVersionRange as VersionRange
from univers.versions import NugetVersion as NuGetVersion


"""
NuGet Float ranges are not yet supported in Univers.

Expand Down
2 changes: 1 addition & 1 deletion tests/nuget/test_nuget_semver_201_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import pytest

from univers.utils import cmp
from univers import nuget
from univers.utils import cmp


# A normal version number MUST take the form X.Y.Z
Expand Down
1 change: 1 addition & 0 deletions tests/test_alpine.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from typing import NamedTuple

import pytest

from univers.versions import AlpineLinuxVersion
from univers.versions import InvalidVersion

Expand Down
13 changes: 13 additions & 0 deletions tests/test_codestyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,16 @@ def test_codestyle(self):
" python -m black -l 100 setup.py src tests",
e.output,
) from e

args = "isort --check-only src tests setup.py"
try:
subprocess.check_output(args.split())
except Exception as e:
print("===========================================================")
print(e.output)
print("===========================================================")
raise Exception(
"Unsorted imports, please sort your imports using isort. "
"Alternatively, run ``isort src tests setup.py``",
e.output,
) from e
2 changes: 1 addition & 1 deletion tests/test_debian_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
import pytest

import univers.debian as version
from univers.debian import Version
from univers.debian import compare_strings
from univers.debian import compare_versions
from univers.debian import Version

"""
Parse, compare and sort Debian package versions.
Expand Down
1 change: 1 addition & 0 deletions tests/test_gentoo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@


from unittest import TestCase

from univers.gentoo import vercmp


Expand Down
4 changes: 2 additions & 2 deletions tests/test_maven_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

import unittest

from univers.maven import Restriction
from univers.maven import RestrictionParseError
from univers.maven import Version
from univers.maven import VersionRange
from univers.maven import RestrictionParseError
from univers.maven import VersionRangeParseError
from univers.maven import Restriction


class TestRestriction(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_maven_version_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#
# Visit https://aboutcode.org and https://github.com/nexB/univers for support and download.

from univers.version_range import MavenVersionRange
from univers.version_constraint import VersionConstraint
from univers.version_range import MavenVersionRange
from univers.versions import MavenVersion


Expand Down
1 change: 1 addition & 0 deletions tests/test_nuget.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# https://github.com/NuGet/NuGet.Client/blob/dev/test/NuGet.Core.Tests/NuGet.Versioning.Test/VersionComparerTests.cs

import unittest

from univers.versions import NugetVersion


Expand Down
1 change: 1 addition & 0 deletions tests/test_openssl_vercmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import operator

import pytest

from univers.versions import LegacyOpensslVersion
from univers.versions import OpensslVersion
from univers.versions import SemverVersion
Expand Down
1 change: 1 addition & 0 deletions tests/test_openssl_versort.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from pathlib import Path

from commoncode import testcase

from tests import util_tests
from univers.versions import OpensslVersion

Expand Down
3 changes: 2 additions & 1 deletion tests/test_pypi_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
#
# Visit https://aboutcode.org and https://github.com/nexB/univers for support and download.

from packaging import version as packaging_version
from unittest import TestCase

from packaging import version as packaging_version

from univers import versions

# version comparison is already tested at:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_skeleton_codestyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
# See https://aboutcode.org for more information about nexB OSS projects.
#

import configparser
import subprocess
import unittest
import configparser


class BaseTests(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_vers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import os
import re
import unittest
from unittest.case import expectedFailure

from univers.version_range import VersionRange
from unittest.case import expectedFailure


def create_test_function(
Expand Down
15 changes: 8 additions & 7 deletions tests/test_version_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,25 @@

import json
from unittest import TestCase

import pytest

from univers.version_constraint import VersionConstraint
from univers.version_range import RANGE_CLASS_BY_SCHEMES
from univers.version_range import GemVersionRange
from univers.version_range import InvalidVersionRange
from univers.version_range import MattermostVersionRange
from univers.version_range import from_gitlab_native
from univers.version_range import NpmVersionRange
from univers.version_range import NugetVersionRange
from univers.version_range import InvalidVersionRange
from univers.version_range import OpensslVersionRange
from univers.version_range import PypiVersionRange
from univers.version_range import VersionRange
from univers.version_range import RANGE_CLASS_BY_SCHEMES
from univers.version_range import NpmVersionRange
from univers.version_range import OpensslVersionRange
from univers.versions import PypiVersion
from univers.version_range import from_gitlab_native
from univers.versions import NugetVersion
from univers.versions import OpensslVersion
from univers.versions import PypiVersion
from univers.versions import RubygemsVersion
from univers.versions import SemverVersion
from univers.versions import OpensslVersion


class TestVersionRange(TestCase):
Expand Down