#509 layout module
Merged by onosek. Opened by lrossett.
lrossett/rpkg layout-module  into  master

Download 509.patch

Signed-off-by: lrossett lrossett@redhat.com
This PR is a continuation of the work done on https://pagure.io/rpkg/pull-request/393 by @bstinson.

There are still a few code pieces that need to be changed but I wanted to get an early feedback for the proposed solution.

Proposal

  • Adds a Layout metaclass and base class to be inherited by other layout implementation classes;
  • Every class that inherits from BaseLayout gets automatically added into the metaclass to be used by the build function;
  • Layout classes are added by order of code definition in the _layouts list;

rebased onto ef229c2c5c1555f3624f9673387a6cc9038dc931

rebased onto 9d58a539634ac1f48e3855f01945a34fc5d45c0d

rebased onto afcc2bc1975462699b378cbc6890167954e7d802

rebased onto 91da14d4946ec3ba7a2c8e48e625b30e3b768cbe

rebased onto 26141414394e75849966e6b84faf549d84dfc61e

pretty please pagure-ci rebuild

can wildcard be avoided somehow?

May I ask you to add a comment to the commit message? Something describing the purpose, like the description of the PR itself (or some text from the original #393).

I have noticed that in tests/test_cli.py there is self.srcrpmdir used. Doesn't it conflict with newly moved variable to self.layout.srcrpmdir?

isn't self.srcrpmdir just a property of the test class that is used in a cli test case?

rebased onto 81a0ee184e052f34d3c98abc339641efde3bdb7e

rebased onto 31c7c6535b2b50b584d3bd5f635a2cc5f2d49bc0

-        self.assertEqual('spec file not found.', e.exception.args[0])
+        self.assertEqual('package path does not exist', e.exception.args[0])

super method raises its exception (from "abstract" method) earlier than comparation in a specific method is reached. In the current situation, input of the test can not be not existing dir.

-        self.assertEqual('spec file not found.', e.exception.args[0])
+        self.assertEqual('SPECS dir not found.', e.exception.args[0])

Unlike the previous failed test case, we have dir that exists (srpm-specless). So it ends with raising exception during SPECS directory test.

Above suggestions should resolve failing unittests without changing the code itself. But if the intended behaviour was different, please, modify the code in Layout classes.

isn't self.srcrpmdir just a property of the test class that is used in a cli test case?

OK, it looks you are right. It doesn't colide with the new functionality.

ok I will apply those changes but I am confused because tox was working locally and applying it made it fail now

rebased onto a95bad2ed57e500a9f9c1ec50d1c5cdacffca5f4

I think the problem was that those empty folders were not being committed so I added an empty file (.gitkeep) in those dirs.

I think the problem was that those empty folders were not being committed so I added an empty file (.gitkeep) in those dirs.

Yes, it looks like it. That is great. We can move further. I will merge it.

Pull-Request has been merged by onosek

Metadata