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
Added Pathlib.Path support: Issue #3731 #4074
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4074 +/- ##
==========================================
+ Coverage 83.36% 83.39% +0.03%
==========================================
Files 165 165
Lines 9802 9803 +1
Branches 1462 1463 +1
==========================================
+ Hits 8171 8175 +4
+ Misses 1366 1365 -1
+ Partials 265 263 -2
|
I believe the proposed fix #3753 is slightly cleaner. Also, both patches are missing an accompanying test that covers the change. Could you add one? |
I am confused on how and where to add a test. Could you please guide a bit? |
Have a look at the tests in https://github.com/scrapy/scrapy/blob/master/tests/test_feedexport.py, see if you can get some ideas. Otherwise, I’ll see if I can take a closer look myself and give you some better feedback. |
I did look into that file. However, I could not even find the class which I had made changes to (FeedExporter) being imported into the test file. Also, I could not find any existing tests for FeedExporter from which I could get any ideas. |
Forget about the class, navigating the internals of Scrapy can be daunting at first. Instead, focus on the way users would take advantage of your changes: the Existing tests get a temporary folder automatically created for them and assigned to For example, based on @defer.inlineCallbacks
def test_pathlib_uri(self):
tmpdir = tempfile.mkdtemp()
feed_uri = Path(tmpdir) / 'res'
settings = {
'FEED_FORMAT': 'csv',
'FEED_STORE_EMPTY': True,
'FEED_URI': feed_uri,
}
data = yield self.exported_no_data(settings)
self.assertEqual(data, b'')
shutil.rmtree(tmpdir, ignore_errors=True) |
I think it’s OK not to support Python 2, as we will drop support soon, right after releasing the upcoming 1.8 version of Scrapy. |
@Gallaecio I do not understand why the Travis CI build is not triggering for the last 2 commits. Am I doing anything wrong? |
Your changes are currently in conflict with the |
@Gallaecio |
Now people will review your changes. We usually merge a pull request once two core developers have approved it. |
Fixes #3731