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

nixos/python: add pytest-bdd module. #72495

Merged
merged 2 commits into from Dec 4, 2019
Merged

Conversation

jm2dev
Copy link
Contributor

@jm2dev jm2dev commented Nov 1, 2019

Motivation for this change
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 nix-review --run "nix-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.
Notify maintainers

cc @

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/pytest-bdd-on-shell-nix/4616/6

propagatedBuildInputs = [ glob2 Mako parse parse-type py pytest six ];

# Tests require extra dependencies
doCheck = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

that fine... just add them to checkInputs

Suggested change
doCheck = false;
checkInputs = [ mock ];

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After running the following command:

find pkgs/development/python-modules -name default.nix | xargs grep doCheck | grep pytest

I suspect we really need that doCheck = false.

Copy link
Contributor

Choose a reason for hiding this comment

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

no... doCheck = false; will make it skip the checkPhase entirely

Here's how i would do this expression:

{ stdenv, buildPythonPackage, fetchFromGitHub
, execnet
, glob2
, Mako
, mock
, parse
, parse-type
, py
, pytest
, six
}:

buildPythonPackage rec {
  pname = "pytest-bdd";
  version = "3.2.1";

  # tests are not included in pypi tarball
  src = fetchFromGitHub {
    owner = "pytest-dev";
    repo = pname;
    rev = version;
    sha256 = "02y28l5h1m9grj54p681qvv7nrhd7ly9jkqdchyw4p0lnmcmnsrd";
  };

  propagatedBuildInputs = [ glob2 Mako parse parse-type py pytest six ];

  checkInputs = [ execnet mock pytest ];
  checkPhase = ''
    pytest
  '';

  meta = with stdenv.lib; {
    description = "BDD library for the py.test runner";
    homepage = https://github.com/pytest-dev/pytest-bdd;
    license = licenses.mit;
    maintainers = with maintainers; [ jm2dev ];
  };
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks to that "fetchFromGitHub" now I'm aware of the available fetchers, and I suspect you have plenty of experience with python pips.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a co-owner of the nixpkgs python packages, only done a few hundred

@jonringer
Copy link
Contributor

also, to adhere to contributing guidelines, please rename the PR and commit to:

pythonPackages.pytest-bdd: init at 3.2.0

@jonringer
Copy link
Contributor

nix-env failed:
error: while evaluating anonymous function at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-1-lassulus.ewr1.nix.ci/.gc-of-borg-outpaths.nix:44:12, called from undefined position:
while evaluating anonymous function at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-1-lassulus.ewr1.nix.ci/pkgs/top-level/release-lib.nix:121:6, called from /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-1-lassulus.ewr1.nix.ci/lib/attrsets.nix:292:43:
while evaluating 'hydraJob' at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-1-lassulus.ewr1.nix.ci/lib/customisation.nix:166:14, called from /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-1-lassulus.ewr1.nix.ci/pkgs/top-level/release-lib.nix:121:14:
while evaluating the attribute 'meta' at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-1-lassulus.ewr1.nix.ci/lib/customisation.nix:171:24:
while evaluating the attribute 'maintainers' at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-1-lassulus.ewr1.nix.ci/pkgs/development/python-modules/pytest-bdd/default.nix:21:5:
undefined variable 'jm2dev' at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-1-lassulus.ewr1.nix.ci/pkgs/development/python-modules/pytest-bdd/default.nix:21:39

you need to add yourself to maintainers, please look at #72312 as an example of commit message and history :)

@jm2dev
Copy link
Contributor Author

jm2dev commented Dec 4, 2019

Hi, do we have any updates on this PR?

Comment on lines +3107 to +3112
jm2dev = {
email = "jomarcar@gmail.com";
github = "jm2dev";
githubId = 474643;
name = "José Miguel Martínez Carrasco";
};
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be a separate commit, look at #74389 as an example

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

Choose a reason for hiding this comment

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

please reverse the order of the commits:

git rebase -i HEAD^^
# switch the two lines
# save
git push --force ...

Copy link
Contributor

Choose a reason for hiding this comment

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

otherwise checking out the package commit will fail to evaluate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Output of git log --oneline after following your instructions (and pushing to gh):

0bced444e7f (HEAD -> pytest-bdd, origin/pytest-bdd) pythonPackages.pytest-bdd: init at 3.2.1
b1601d57ec9 maintainers: add jm2dev

though github web doesn't show this way.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, I looked at your branch, and it still showed it the other way. guess it is just the web view

@jm2dev jm2dev force-pushed the pytest-bdd branch 3 times, most recently from 8a68b6c to 78fa57a Compare December 4, 2019 16:48
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.

diff LGTM
commits LGTM

[5 built, 0.0 MiB DL]
https://github.com/NixOS/nixpkgs/pull/72495
3 package were built:
python27Packages.pytest-bdd python37Packages.pytest-bdd python38Packages.pytest-bdd

@jonringer
Copy link
Contributor

@GrahamcOfBorg build python27Packages.pytest-bdd python37Packages.pytest-bdd python38Packages.pytest-bdd

@jonringer jonringer merged commit 38d945f into NixOS:master Dec 4, 2019
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

4 participants