Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pythonPackages.mimesis: init at 3.3.0 #79278

Closed
wants to merge 1 commit into from

Conversation

arnoldfarkas
Copy link
Contributor

Motivation for this change

Packaging Python module mimesis in Nix.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@FRidh
Copy link
Member

FRidh commented Feb 9, 2020

@GrahamcOfBorg build pythonPackages.mimesis

@FRidh
Copy link
Member

FRidh commented Feb 9, 2020

@GrahamcOfBorg build python3Packages.mimesis

Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to prevent python2 trying to evaluate


buildPythonPackage rec {
pname = "mimesis";
version = "3.3.0";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
version = "3.3.0";
version = "3.3.0";
disabled = isPy27;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, missed this package is Python 3. let me update

@@ -0,0 +1,30 @@
{ lib, buildPythonPackage, fetchFromGitHub, pytest, pytest-flake8, pytest-isort, pytest-mock, pytz }:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{ lib, buildPythonPackage, fetchFromGitHub, pytest, pytest-flake8, pytest-isort, pytest-mock, pytz }:
{ lib, buildPythonPackage, fetchFromGitHub, isPy27, pytest, pytest-flake8, pytest-isort, pytest-mock, pytz }:

checkPhase = ''
# deselect test_download_image and test_stock_image: the tests require access to external network
# deselect test_cpf_with_666_prefix: mocker cannot be used as context manager
pytest tests -k 'not test_download_image and not test_stock_image and not test_cpf_with_666_prefix'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pytest tests -k 'not test_download_image and not test_stock_image and not test_cpf_with_666_prefix'
pytest tests -k 'not test_download_image and not test_stock_image and not test_cpf_with_666_prefix and not port'

for python3.8, error is with tests, not code.

=================================== FAILURES ===================================
_______________ TestInternet.test_port[PortRange.ALL-excepted0] ________________

self = <tests.test_providers.test_internet.TestInternet object at 0x7fff58800670>
net = <mimesis.providers.internet.Internet object at 0x7fff58810850>
range_ = <PortRange.ALL: (1, 65535)>, excepted = (1, 65535)

    @pytest.mark.parametrize(
        'range_, excepted', [
            (PortRange.ALL, (1, 65535)),
            (PortRange.EPHEMERAL, (49152, 65535)),
            (PortRange.REGISTERED, (1024, 49151)),
        ],
    )
    def test_port(self, net, range_, excepted):
        result = net.port(port_range=range_)
        assert (result >= excepted[0]) and (result <= excepted[1])
        with pytest.raises(NonEnumerableError):
>           net.port('nill')

tests/test_providers/test_internet.py:155:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
mimesis/providers/internet.py:270: in port
    if port_range and port_range in PortRange:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <enum 'PortRange'>, member = 'nill'

    def __contains__(cls, member):
        if not isinstance(member, Enum):
>           raise TypeError(
                "unsupported operand type(s) for 'in': '%s' and '%s'" % (
                    type(member).__qualname__, cls.__class__.__qualname__))
E           TypeError: unsupported operand type(s) for 'in': 'str' and 'EnumMeta'

/nix/store/jdl9dnmb5xciia6vhai8m6flvbhbwsf3-python3-3.8.1/lib/python3.8/enum.py:310: TypeError
____________ TestInternet.test_port[PortRange.EPHEMERAL-excepted1] _____________

self = <tests.test_providers.test_internet.TestInternet object at 0x7fff56783250>
net = <mimesis.providers.internet.Internet object at 0x7fff56783550>
range_ = <PortRange.EPHEMERAL: (49152, 65535)>, excepted = (49152, 65535)

    @pytest.mark.parametrize(
        'range_, excepted', [
            (PortRange.ALL, (1, 65535)),
            (PortRange.EPHEMERAL, (49152, 65535)),
            (PortRange.REGISTERED, (1024, 49151)),
        ],
    )
    def test_port(self, net, range_, excepted):
        result = net.port(port_range=range_)
        assert (result >= excepted[0]) and (result <= excepted[1])
        with pytest.raises(NonEnumerableError):
>           net.port('nill')

tests/test_providers/test_internet.py:155:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
mimesis/providers/internet.py:270: in port
    if port_range and port_range in PortRange:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <enum 'PortRange'>, member = 'nill'

    def __contains__(cls, member):
        if not isinstance(member, Enum):
>           raise TypeError(
                "unsupported operand type(s) for 'in': '%s' and '%s'" % (
                    type(member).__qualname__, cls.__class__.__qualname__))
E           TypeError: unsupported operand type(s) for 'in': 'str' and 'EnumMeta'

/nix/store/jdl9dnmb5xciia6vhai8m6flvbhbwsf3-python3-3.8.1/lib/python3.8/enum.py:310: TypeError
____________ TestInternet.test_port[PortRange.REGISTERED-excepted2] ____________

self = <tests.test_providers.test_internet.TestInternet object at 0x7fff56712400>
net = <mimesis.providers.internet.Internet object at 0x7fff56712370>
range_ = <PortRange.REGISTERED: (1024, 49151)>, excepted = (1024, 49151)

    @pytest.mark.parametrize(
        'range_, excepted', [
            (PortRange.ALL, (1, 65535)),
            (PortRange.EPHEMERAL, (49152, 65535)),
            (PortRange.REGISTERED, (1024, 49151)),
        ],
    )
    def test_port(self, net, range_, excepted):
        result = net.port(port_range=range_)
        assert (result >= excepted[0]) and (result <= excepted[1])
        with pytest.raises(NonEnumerableError):
>           net.port('nill')

tests/test_providers/test_internet.py:155:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
mimesis/providers/internet.py:270: in port
    if port_range and port_range in PortRange:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <enum 'PortRange'>, member = 'nill'

    def __contains__(cls, member):
        if not isinstance(member, Enum):
>           raise TypeError(
                "unsupported operand type(s) for 'in': '%s' and '%s'" % (
                    type(member).__qualname__, cls.__class__.__qualname__))
E           TypeError: unsupported operand type(s) for 'in': 'str' and 'EnumMeta'

/nix/store/jdl9dnmb5xciia6vhai8m6flvbhbwsf3-python3-3.8.1/lib/python3.8/enum.py:310: TypeError
=========== 3 failed, 4206 passed, 1 skipped, 5 deselected in 14.99s ===========

@arnoldfarkas
Copy link
Contributor Author

Closing do a cleanup on our end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants