homebrew-core/Formula/nox.rb

93 lines
4.1 KiB
Ruby

class Nox < Formula
include Language::Python::Virtualenv
desc "Flexible test automation for Python"
homepage "https://nox.thea.codes/"
url "https://files.pythonhosted.org/packages/12/f1/a810cf1f56e47b990824ebbb19e789745e4d1ea80ac0f2b6494c50e3f6a5/nox-2022.8.7.tar.gz"
sha256 "1b894940551dc5c389f9271d197ca5d655d40bdc6ccf93ed6880e4042760a34b"
license "Apache-2.0"
bottle do
rebuild 1
sha256 cellar: :any_skip_relocation, arm64_ventura: "2146a6ad9f253d44ec625d39b6479b881dc8f99d52afbefcd2da937ba1634282"
sha256 cellar: :any_skip_relocation, arm64_monterey: "a5f7f84f53b088fd172be65a628b06168025a13d7d29a18748e8eabf37cb2e3e"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "9e1ea7979b8d6b20139705f65f44ac41440111b715403cf4c8faa12e650da13f"
sha256 cellar: :any_skip_relocation, monterey: "2c1506048ef3e082e0f9cfec0fa4c1f89a0a5343d9d9218fa409f6980600ff24"
sha256 cellar: :any_skip_relocation, big_sur: "b1b46241d6f7c56db4f49aa13242f0e0405eade85fbdb5d104bf543e75088853"
sha256 cellar: :any_skip_relocation, catalina: "007c43be2745ded66b5d6c64cba17e9da570d339e6074c927a953a9c770aa7a3"
sha256 cellar: :any_skip_relocation, x86_64_linux: "f768d9fa8f456dec9528dc58e83d0be10094a2634df02b5ace12271291c7736c"
end
depends_on "python@3.10"
depends_on "six"
depends_on "virtualenv"
resource "argcomplete" do
url "https://files.pythonhosted.org/packages/05/f8/67851ae4fe5396ba6868c5d84219b81ea6a5d53991a6853616095c30adc0/argcomplete-2.0.0.tar.gz"
sha256 "6372ad78c89d662035101418ae253668445b391755cfe94ea52f1b9d22425b20"
end
resource "colorlog" do
url "https://files.pythonhosted.org/packages/8e/8f/1537ebed273d43edd3bb21f1e5861549b7cfcb1d47523d7277cab988cec2/colorlog-6.6.0.tar.gz"
sha256 "344f73204009e4c83c5b6beb00b3c45dc70fcdae3c80db919e0a4171d006fde8"
end
resource "distlib" do
url "https://files.pythonhosted.org/packages/31/d5/e2aa0aa3918c8d88c4c8e4ebbc50a840e101474b98cd83d3c1712ffe5bb4/distlib-0.3.5.tar.gz"
sha256 "a7f75737c70be3b25e2bee06288cec4e4c221de18455b2dd037fe2a795cab2fe"
end
resource "filelock" do
url "https://files.pythonhosted.org/packages/f3/c7/5c1aef87f1197d2134a096c0264890969213c9cbfb8a4102087e8d758b5c/filelock-3.7.1.tar.gz"
sha256 "3a0fd85166ad9dbab54c9aec96737b744106dc5f15c0b09a6744a445299fcf04"
end
resource "packaging" do
url "https://files.pythonhosted.org/packages/df/9e/d1a7217f69310c1db8fdf8ab396229f55a699ce34a203691794c5d1cad0c/packaging-21.3.tar.gz"
sha256 "dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb"
end
resource "platformdirs" do
url "https://files.pythonhosted.org/packages/ff/7b/3613df51e6afbf2306fc2465671c03390229b55e3ef3ab9dd3f846a53be6/platformdirs-2.5.2.tar.gz"
sha256 "58c8abb07dcb441e6ee4b11d8df0ac856038f944ab98b7be6b27b2a3c7feef19"
end
resource "py" do
url "https://files.pythonhosted.org/packages/98/ff/fec109ceb715d2a6b4c4a85a61af3b40c723a961e8828319fbcb15b868dc/py-1.11.0.tar.gz"
sha256 "51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"
end
resource "pyparsing" do
url "https://files.pythonhosted.org/packages/71/22/207523d16464c40a0310d2d4d8926daffa00ac1f5b1576170a32db749636/pyparsing-3.0.9.tar.gz"
sha256 "2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb"
end
def install
virtualenv_install_with_resources
(bin/"tox-to-nox").unlink
# we depend on virtualenv, but that's a separate formula, so install a `.pth` file to link them
site_packages = Language::Python.site_packages("python3.10")
virtualenv = Formula["virtualenv"].opt_libexec
(libexec/site_packages/"homebrew-virtualenv.pth").write virtualenv/site_packages
end
test do
ENV["LC_ALL"] = "en_US.UTF-8"
(testpath/"noxfile.py").write <<~EOS
import nox
@nox.session
def tests(session):
session.install("pytest")
session.run("pytest")
EOS
(testpath/"test_trivial.py").write <<~EOS
def test_trivial():
assert True
EOS
assert_match "usage", shell_output("#{bin}/nox --help")
assert_match "1 passed", shell_output("#{bin}/nox")
end
end